From ead39fb31baf3e7faff6ef88b163c857c3593c6d Mon Sep 17 00:00:00 2001 From: 4-Dimensions Date: Wed, 12 Feb 2025 11:17:11 +0300 Subject: [PATCH] RQ 3 --- PasswordLockoutRequirement.java | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 PasswordLockoutRequirement.java diff --git a/PasswordLockoutRequirement.java b/PasswordLockoutRequirement.java new file mode 100644 index 0000000..2c1359d --- /dev/null +++ b/PasswordLockoutRequirement.java @@ -0,0 +1,32 @@ +public class PasswordLockoutRequirement extends Requirement { + + private int failedLoginAttempts; + private boolean isLocked; + + public PasswordLockoutRequirement(String username) { + super(username); + failedLoginAttempts = 0; + isLocked = false; + } + + @Override + public CheckStatus check() { + + if (this.getStatement() == null) { + return CheckStatus.INCOMPLETE; + } + + if (!isLocked && failedLoginAttempts < 5) { + } + return CheckStatus.FAIL; + } + + public void resetFailedAttempts() { + failedLoginAttempts = 0; + } + + public void recordFailedAttempt() { + failedLoginAttempts += 1; + } + +}