Added the lockout logic

This pull request adds the 'lockout' logic that locks the user out after three failed attempts.