Esempio n. 1
0
        public async Task <Response <UserResponse> > Authentification(Request request)
        {
            var user = await _uow.Users.FindAsync(new Guid(request.RequestIdentity.UserId));

            if (user == null)
            {
                return(new Response <UserResponse>(ResponseStatus.NotFound, null, ResponseMessagesConstans.NotFound));
            }

            var token = _authentificationLibrary.GenerateJWT(user);

            return(new Response <UserResponse>(ResponseStatus.Ok, _mapService.MapUser(user, token)));
        }
Esempio n. 2
0
        public async Task <bool> SendResetPasswordEmail(UserModel user)
        {
            var token = _authentificationLibrary.GenerateJWT(user);

            return(await SendTransactionalEmail(
                       MailingConstants.ResetPassword,
                       user.Email,
                       user.GetName(),
                       new {
                user.Email,
                ResetPasswordPageUrl = $"{RoutesConstants.BaseUrlClient}/{RoutesConstants.ResetPagePath}?jwt={token.Jwt}&expiresDate={token.ExpiresDate.ToServerFormat()}"
            }
                       ));
        }