I want to set Account Lockout policy, so that after several failed attempts, the user will be lockout of their account for specific duration.
By @Danial22236738npv0
That is a good question. It is in fact one of the commonest use-cases among login requirements.
There is no universal solution. It all depends on your specific requirements. So, start by specifying your requirements, in layman's terms. For example,
- What is the number of failed login attempts after which user will be locked out?
- Is that number counted per session or for a given time interval?
- How long is the lock-out duration?
- What happens when a locked-out user attempts to log in? What is the feedback to the user?
I shall now give you a description of a possible solution.
- When a user proceeds to log in, the application queries the database table, lockedOutUser, to determine whether the user is currently locked out. If so, the user is redirected ("gently eased out of the application") to the page lockedOut.cfm. The page tells the user, in friendly terms, why he or she is locked out and how long the lock-out will last. (Frame your interaction positively: "You will be able to log in after 10 minutes. See you then." is preferable to "You will be prevented from logging in for 10 minutes.")
- The application stores the user's login properties as session variables, including session.numberOfFailedLoginAttempts, whose default value is 0.
- Session.numberOfFailedLoginAttempts increases by 1 whenever login fails.
- When session.numberOfFailedLoginAttempts reaches the maximum value allowed, the user-credentials, numberOfFailedLoginAttempts, lock-out time, and any other relevant information is stored in the table, lockedOutUser.