コード例 #1
0
        private void UpdatePassword(UpdateCurrentUserPasswordCommand command, IExecutionContext executionContext, User user)
        {
            EntityNotFoundException.ThrowIfNull(user, executionContext.UserContext.UserId);
            var userArea = _userAreaRepository.GetByCode(user.UserAreaCode);

            _passwordUpdateCommandHelper.ValidateUserArea(userArea);

            if (!_userAuthenticationHelper.IsPasswordCorrect(user, command.OldPassword))
            {
                throw ValidationErrorException.CreateWithProperties("Incorrect password", "OldPassword");
            }

            _passwordUpdateCommandHelper.UpdatePassword(command.NewPassword, user, executionContext);
        }
コード例 #2
0
        private UserLoginInfo MapResult(GetUserLoginInfoIfAuthenticatedQuery query, User user)
        {
            if (_userAuthenticationHelper.IsPasswordCorrect(user, query.Password))
            {
                var result = new UserLoginInfo()
                {
                    RequirePasswordChange = user.RequirePasswordChange,
                    UserAreaCode          = user.UserAreaCode,
                    UserId = user.UserId
                };

                return(result);
            }

            return(null);
        }