Inspiration
we noticed how helpful 2-step verification is and how rare it is so we wanted to make a universal version to help protect users privacy and accounts,
What it does
it is a universal 2-step verification via email or security questions, also checking IP addresses.
How we built it
we used java to create the buttons and run the 2 step verification. when the user creates the account we have them create a security question, password, enter their email, and collect their IP address. then each time the user is prompted to log in, another prompt pops up asking the user if they want to answer a security question or be emailed a verification code.
Challenges we ran into
collecting the user IP address and integrating the java security check with HTML log in prompt to the user
Accomplishments that we're proud of
being able to have java interact with various web pages to detect when someone is logging in.
What we learned
we gained a much broader knowledge of java and HTML. We were exposed to how coding and cyber security would work in the real world.
code import javax.swing.; import java.awt.event.; import java.applet.; import java.net.; import java.util.*;
public class Main {
public static void main(String[] args) {
/() JFrame popup = new JFrame("Welcome to Two Factor Authentification");
popup.setSize(400, 400);
popup.setLocation(200, 200);
popup.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
popup.setContentPane(new Main());
popup.setVisible(true);/
//creates buttons
JFrame fcode = new JFrame("Button Example");
//code button
JButton bcode = new JButton("Temporary Code");
bcode.setBounds(20, 300, 150, 50);
fcode.add(bcode);
fcode.setSize(600, 600);
fcode.setLayout(null);
fcode.setVisible(true);
//call button
JButton bcall = new JButton("Phone call");
bcall.setBounds(400, 300, 150, 50);
fcode.add(bcall);
fcode.setSize(600, 600);
fcode.setLayout(null);
fcode.setVisible(true);
//question button
JButton bquestion = new JButton("Security Questions");
bquestion.setBounds(200, 300, 175, 50);
fcode.add(bquestion);
fcode.setSize(600, 600);
fcode.setLayout(null);
fcode.setVisible(true);
//
//code button clicked
bcode.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JFrame f=new JFrame("Password Field Example");
final JLabel label = new JLabel();
label.setBounds(120,140, 200,50); //result
final JPasswordField value = new JPasswordField();
value.setBounds(120,20,100,30); //textfield
JLabel l1=new JLabel("code:");
l1.setBounds(20,20, 80,30);
JButton b = new JButton("Login");
b.setBounds(120,120, 80,30); //button
final JTextField text = new JTextField();
f.add(value); f.add(l1); f.add(label); f.add(b); f.add(text);
f.setSize(600,600);
f.setLayout(null);
f.setVisible(true);
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(value.getText().equals("tempCode")){
label.setText("correct!");
f.setVisible(false);
}
else{
label.setText("wrong!");
}
}
});
}
});
// /code button
//
//call button clicked
bcall.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JFrame f=new JFrame("Password Field Example");
final JLabel label = new JLabel();
label.setBounds(120,140, 200,50); //result
final JPasswordField value = new JPasswordField();
value.setBounds(120,50,100,30); //textfield
JLabel l1=new JLabel("Phone call is being sent!");
l1.setBounds(50,20, 200,30);
JButton b = new JButton("Login");
b.setBounds(120,120, 80,30); //button
final JTextField text = new JTextField();
f.add(value); f.add(l1); f.add(label); f.add(b); f.add(text);
f.setSize(600,600);
f.setLayout(null);
f.setVisible(true);
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(value.getText().equals("tempCode")){
label.setText("correct!");
f.setVisible(false);
}
else{
label.setText("wrong!");
}
}
});
}
});
//
// question button clicked
bquestion.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JFrame f=new JFrame("Password Field Example");
final JLabel label = new JLabel();
label.setBounds(120,140, 200,50); //result
final JPasswordField value = new JPasswordField();
value.setBounds(120,50,100,30); //textfield
JLabel l1=new JLabel("first security question: ...");
l1.setBounds(50,20, 200,30);
JButton b = new JButton("Login");
b.setBounds(120,120, 80,30); //button
final JTextField text = new JTextField();
f.add(value); f.add(l1); f.add(label); f.add(b); f.add(text);
f.setSize(600,600);
f.setLayout(null);
f.setVisible(true);
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(value.getText().equals("tempCode")){
label.setText("correct!");
f.setVisible(false);
}
else{
label.setText("wrong!");
}
}
});
}
});
}
}
Built With
- java
- replit
Log in or sign up for Devpost to join the conversation.