Ejemplo n.º 1
0
        public bool ResetPassword(PasswordReset passwordReset)
        {
            DatabaseUser databaseUser = _dbQueryService.GetUserByPasswordResetToken(passwordReset.Token);

            if (databaseUser == null)
            {
                return(false);
            }

            databaseUser.Salt     = UserPasswordTools.GenerateRandomPasswordSalt();
            databaseUser.Password = UserPasswordTools.HashAndSaltPassword(passwordReset.Password, databaseUser.Salt);

            if (_dbQueryService.PersistPasswordChange(databaseUser))
            {
                _dbQueryService.PersistRemovePasswordResetToken(passwordReset.Token);
                return(true);
            }

            return(false);
        }