コード例 #1
0
        private async Task <ApiResponse> ResetUserPassword(ResetPasswordViewModel model)
        {
            var apiResp = new ApiResponse
            {
                Type = ResponseType.Fail
            };

            var confirmResp = await _security.ConfirmPasswordReset(model.Password, model.SecurityCode);

            if (confirmResp.Type != ResponseType.Success)
            {
                apiResp.ErrorCode = confirmResp.ErrorCode;
                return(apiResp);
            }

            var resp = await _security.ChangePassword(confirmResp.Data, model.Password);

            if (resp.Type != ResponseType.Success)
            {
                apiResp.ErrorCode = resp.ErrorCode;
                return(apiResp);
            }

            apiResp.Type = ResponseType.Success;
            return(apiResp);
        }
コード例 #2
0
        public IActionResult OnPost()
        {
            try
            {
                if (ModelState.IsValid != true)
                {
                    return(Page());
                }

                bool Ischanged = m_Security.ChangePassword(ChangePasswordModelData.LoginID, ChangePasswordModelData.Password, ChangePasswordModelData.NewPassword);

                if (Ischanged)
                {
                    return(RedirectToPage(Navigator.Dashboard));
                }
                else
                {
                    ModelState.AddModelError(" ", "Your Current Login ID & Password Do Not Match.  Please Try Again");
                    return(Page());
                }
            }
            catch (Exception ex)
            {
                m_Log.CriticalEntry(User.Identity.Name, ex.ToString());
                throw;
            }
        }
コード例 #3
0
 public bool ChangePassword(ISecurity security, CustomChangePassword customChangePassword, int TenantId, int UserID)
 {
     _SecurityRepository = security;
     return(_SecurityRepository.ChangePassword(customChangePassword, TenantId, UserID));
 }