Beispiel #1
0
        private ResetPasswordResponse GetResetPasswordDetail(ResetPasswordTokenRequest resetPasswordTokenRequest)
        {
            var response = new ResetPasswordResponse();
            try
            {
                response = DataContext.ResetPasswords.First(x => x.Token == resetPasswordTokenRequest.Token).MapTo<ResetPasswordResponse>();

                if (response.ExpireDate < DateTime.Now)
                {
                    response.IsSuccess = false;
                    response.Message = "Token Already Expired!";
                    return response;
                }
                if (response.Status)
                {
                    response.IsSuccess = false;
                    response.Message = "Token Already Used!";
                    return response;
                }

                response.Profile = GetUserByEmail(new GetUserRequest { Email = response.Email }).MapTo<ResetPasswordResponse.User>();
                response.IsSuccess = true;
            }
            catch (System.InvalidOperationException x)
            {
                return new ResetPasswordResponse
                {
                    IsSuccess = false,
                    Message = x.Message
                };
            }
            return response;
        }
Beispiel #2
0
 public ResetPasswordResponse GetUserByToken(ResetPasswordTokenRequest request)
 {
     var response = new ResetPasswordResponse();
     response = this.GetResetPasswordDetail(new ResetPasswordTokenRequest { Token = request.Token });
     return response;
 }