Наследование: JsonResponse
Пример #1
0
        public override void HandleRequest(string jsonString, AjaxBase ajax)
        {
            LoginRequest request = Utility.ParseJson<LoginRequest>(jsonString);

            User user = null;
            if (request.username == null)
            {
                if (request.password == null)
                {
                    user = User.GetUser(SessionWrapper.GetUserName(ajax));
                }
            }
            else
            {
                user = User.GetUser(request.username, request.password);
            }

            LoginResponse response = new LoginResponse();

            if (user == null)
            {
                response.username = "";
                response.admin = false;
            }
            else
            {
                response.username = user.Username;
                response.admin = user.Admin;
            }

            SessionWrapper.SetUserName(ajax, response.username);

            ajax.ReturnJson(response);
        }
Пример #2
0
 private void LoginSuccess(LoginResponse userInfo)
 {
     if (userInfo.admin)
     {
         AdminCollectionsModule.Instance.Show(null);
     }
     else
     {
         LoginFailure(new Exception(Strings.Get("NoAdminRight")));
     }
 }
Пример #3
0
        private void LoginSuccess(LoginResponse response)
        {
            loggingIn = false;
            userInfo = response;
            LoginWidget.RefreshAll();

            if (String.IsNullOrEmpty(response.username))
            {
                ErrorModal.ShowError(Strings.Get("WrongUserNameOrPassword"));
            }
            else
            {
                InternalHide();
                successCallback(response);
            }
        }
Пример #4
0
 private static void LogoutSuccessful(LoginResponse response)
 {
     userInfo = response;
     LoginWidget.RefreshAll();
 }
Пример #5
0
        private static void CheckUserNameSuccess(LoginResponse response, bool skipCurrentUserInfo)
        {
            userInfo = response;

            if (skipCurrentUserInfo || (String.IsNullOrEmpty(response.username) && showPrompt))
            {
                Prompt();
            }
            else
            {
                successCallback(response);
            }
        }