Inheritance: JsonResponse
        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);
        }
Beispiel #2
0
 private void LoginSuccess(LoginResponse userInfo)
 {
     if (userInfo.admin)
     {
         AdminCollectionsModule.Instance.Show(null);
     }
     else
     {
         LoginFailure(new Exception(Strings.Get("NoAdminRight")));
     }
 }
Beispiel #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);
            }
        }
Beispiel #4
0
 private static void LogoutSuccessful(LoginResponse response)
 {
     userInfo = response;
     LoginWidget.RefreshAll();
 }
Beispiel #5
0
        private static void CheckUserNameSuccess(LoginResponse response, bool skipCurrentUserInfo)
        {
            userInfo = response;

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