Beispiel #1
0
        public async Task <ChangePasswordResult> Handle(ChangePasswordCommand request, CancellationToken cancellationToken)
        {
            if (string.IsNullOrWhiteSpace(request.NewPassword))
            {
                throw new PasswordNoProperProvidedException();
            }

            User user = await _userAuthService.AssertAuthorityToOperateOn(request.UserRefKey, request.OldPassword);

            _passService.SetPasswordForUser(request.NewPassword, user);
            await _context.SaveChangesAsync(cancellationToken);

            return(new ChangePasswordResult());
        }