refactoring code related to HMAC password reset