Refactored new password and lockout functions