public DrupalSessionObject UserLogin(string username, string password) { this.InitRequest(); DrupalSessionObject res = default(DrupalSessionObject); try { res = drupalServiceSystem.UserLogin(username, password); } catch (Exception ex) { this.HandleException(ex, "UserLogin"); } return(res); }
// public event DrupalAsyncCompletedEventHandler<...> SystemSetVariableCompleted; // public event DrupalAsyncCompletedEventHandler<...> SystemDelVariableCompleted; /// <summary> /// Returns the details of currently logged in user. /// </summary> /// <returns>Object with session id, session name and a user object.</returns> public DrupalSessionObject SystemConnect() { this.InitRequest(); DrupalSessionObject res = default(DrupalSessionObject); try { res = drupalServiceSystem.SystemConnect(); } catch (Exception ex) { this.HandleException(ex, "SystemConnect"); } return(res); }
public bool Logout() { _isLoggedIn = _isLoggedIn && !this.UserLogout(); if (_isLoggedIn) { this.HandleException(new Exception("Unable to logout."), "Logout"); } else { _sessionData = default(DrupalSessionObject); } return(!_isLoggedIn); }
public bool Login(string username, string password) { _username = username; _password = password; _sessionData = this.UserLogin(_username, _password); _isLoggedIn = (_sessionData.user.name == _username); if (!_isLoggedIn) { this.HandleException(new Exception("Unable to login."), "Login"); } return(_isLoggedIn); }
void OnUserLoginCompleted(IAsyncResult asyncResult) { if (this.UserLoginCompleted != null) { var clientResult = (XmlRpcAsyncResult)asyncResult; DrupalSessionObject result = default(DrupalSessionObject); try { result = ((IServiceSystem)clientResult.ClientProtocol).EndUserLogin(asyncResult); this.UserLoginCompleted(this, new DrupalAsyncCompletedEventArgs <DrupalSessionObject>(result, null, asyncResult.AsyncState)); } catch (Exception ex) { this.UserLoginCompleted(this, new DrupalAsyncCompletedEventArgs <DrupalSessionObject>(result, ex, asyncResult.AsyncState)); } } }