public AuthResult ChangePassword(ChangePwdRequest changePwdRequest) { AuthResult authResult = null; try { int userId = ServiceHelper.CurrentUserId; authResult = AccountHandler.ChangePassword(userId, changePwdRequest.CurrentPwd, changePwdRequest.NewPassword); if (authResult.AuthStatus == AuthStatus.OK) { authResult = JWTHandler.CreateToken(authResult); } } catch (Exception ex) { Logger.LogException(ex); authResult.AuthStatus = AuthStatus.ERROR; } if (authResult.AuthStatus != AuthStatus.OK) { ServiceHelper.ThrowBadRequest <AuthResult>(Request, authResult); } return(authResult); }
public ActionResult ChangePassword(int playerId) { WorkerDTO worker = WorkerRepository.Instance.GetDTOById(playerId); //PlayerEngineDTO player = PlayerEngineService.Instance.GetById(playerId); AccountHandler.ChangePassword(worker.Email, "Gamific123"); return(Json(new { ok = true }, JsonRequestBehavior.AllowGet)); }