Exemplo n.º 1
0
        public void UpdatePassword(string newPassword, string passwordResetEntryKey)
        {
            var passwordLink = _passwordResetService.GetPasswordLink(passwordResetEntryKey);

            if (!_passwordResetService.IsKeyValid(passwordLink))
            {
                throw new ApplicationException("Password key is invalid");
            }

            var user = passwordLink.User;

            user.Password = _hashService.CreateHash(newPassword);

            var userDto = Mapper.Map <UserDto>(user);

            _userService.Update(user.Id, password: user.Password);
            _passwordResetService.UpdateLinkActivatedDate(passwordLink);
        }