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); }
private void LoginSuccess(LoginResponse userInfo) { if (userInfo.admin) { AdminCollectionsModule.Instance.Show(null); } else { LoginFailure(new Exception(Strings.Get("NoAdminRight"))); } }
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); } }
private static void LogoutSuccessful(LoginResponse response) { userInfo = response; LoginWidget.RefreshAll(); }
private static void CheckUserNameSuccess(LoginResponse response, bool skipCurrentUserInfo) { userInfo = response; if (skipCurrentUserInfo || (String.IsNullOrEmpty(response.username) && showPrompt)) { Prompt(); } else { successCallback(response); } }