LOGIN
Since the 60s there have been security authentication protocols, and today we have here a login using 2 Factors.
- Basic login Factor: credentials(email, user id, password)
- Advanced login Factor: Verify Humanity(answer a multiple choice question to verify humanity)
- import static java.lang.System.out;
- import java.util.Scanner;
- public class Wizardslogmin {
- public static void main(String[] args) {
- // THE STRING CREATES A SET OF VARIABLES WE WILL USE IN THE PROJECT
- String UserID;
- String UserPassword;
- String uEMAIL;
- String HUMAN;
- // THIS IS DEFINING THE VALUES OF THE STRINGS
- UserPassword = "ALCHEMIST1@1";
- UserID = "STAFFHOLDER";
- uEMAIL = "WIRED2TECH@AOL.COM";
- HUMAN = "YES";
- // THE SCANNER FORWARDS THE TEXT ONTO THE SCREEN AND WAITS FOR THE USERS RESPONSE
- Scanner input1 = new Scanner(System.in);
- System.out.println("please Enter UserID : ");
- String userID = input1.next();
- Scanner input2 = new Scanner(System.in);
- System.out.println(" please Enter UserPassword : ");
- String Userpassword = input2.next();
- Scanner input3 = new Scanner (System.in);
- System.out.println("please enter your EMAIL : ");
- input3.next(uEMAIL);
- Scanner input4 = new Scanner (System.in);
- System.out.println("Confirm Humanity (YES/NO): ");
- input4.next(HUMAN);
- // THIS CREATES A CONDITION FOR ACCESSIBILITY( CONDITIONS TO PASS AND GAIN ACCESS)
- if (uEMAIL.equals(uEMAIL) && Userpassword.equals(Userpassword) && UserID.equals(UserID) && HUMAN.equals(HUMAN)) {
- System.out.println("ACCESS GRANTED");
- }
- // THIS CREATES THE CONDITIONS NEEDED TO DENY ACCESS AND SENDS A NOTIFICATION TO THE END-USER IF THE USER MEETS THE CONDITION TO BE DENIED ACCESS
- else if (userID.equals(UserID)) {
- System.out.println("wrong UserPassword!");
- } else if (Userpassword.equals(UserPassword)) {
- System.out.println("wrong UserID!");
- } else if (uEMAIL.equals(uEMAIL)){
- System.out.println("wrong email!!");
- } else if (HUMAN.equals(HUMAN)){
- System.out.println("not human!!!");
- }
- else {
- System.out.println("wrong UserID, EMAIL OR UserPassword OR U ARE NOT HUMAN!! check what your typing HUMAN/BOT!!!");
- }
- }
- }

Java login app by Mohammed Ibrahim Mirza Beig is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Based on a work at https://www.wired2tech.org/2018/04/java-login-with-security-requirements.html.
Comments
Post a Comment