Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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));
        }