-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathMain.java
46 lines (37 loc) · 1.55 KB
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// Initialize requirement for a specific user
String username = "user1";
PasswordLockoutRequirement lockoutRequirement = new PasswordLockoutRequirement(username);
while (true) {
System.out.println("\nChoose an action:");
System.out.println("1. Simulate failed login attempt");
System.out.println("2. Reset failed attempts");
System.out.println("3. Check lockout status");
System.out.println("4. Exit");
int choice = scanner.nextInt();
switch (choice) {
case 1:
lockoutRequirement.recordFailedAttempt();
System.out.println("Failed attempt recorded.");
break;
case 2:
lockoutRequirement.resetFailedAttempts();
System.out.println("Failed attempts reset.");
break;
case 3:
Checkable.CheckStatus status = lockoutRequirement.check();
System.out.println("Password lockout requirement check: " + status);
break;
case 4:
System.out.println("Exiting...");
scanner.close();
System.exit(0);
default:
System.out.println("Invalid choice. Please try again.");
}
}
}
}