public function login($username, $password) {
        $credentials = array(
            'lgname' => $username,
            'lgpassword' => $password
        );
        $firstlogin = $this->client->login($credentials);
        $this->failOnError("Wiki login failed.", $firstlogin);
        $resultMsg = $firstlogin['login']['result'];
        if ($resultMsg != "NeedToken" && $resultMsg != "Success") {
            throw new SessionException("Wiki login failed: $resultMsg");
        }
        
        if ($resultMsg == "NeedToken") {
            $secondLogin = $this->client->login(array_merge(array(
                'lgtoken' => $firstlogin['login']['token']
            ), $credentials));
            $this->failOnError("Wiki login failed.", $secondLogin);
            $resultMsg = $secondLogin['login']['result'];
            if ($resultMsg != "Success") {
                throw new SessionException("Wiki login failed: $resultMsg");
            }
            $this->tokencache['login'] =  $firstlogin['login']['token'];
        }
    }
public function login($username, $password) {
        $credentials = array(
            'lgname' => $username,
            'lgpassword' => $password
        );
        $firstlogin = $this->client->login($credentials);
        $this->failOnError("Wiki login failed.", $firstlogin);
        $resultMsg = $firstlogin['login']['result'];
        if ($resultMsg != "NeedToken" && $resultMsg != "Success") {
            throw new SessionException("Wiki login failed: $resultMsg");
        }
        
        if ($resultMsg == "NeedToken") {
            $secondLogin = $this->client->login(array_merge(array(
                'lgtoken' => $firstlogin['login']['token']
            ), $credentials));
            $this->failOnError("Wiki login failed.", $secondLogin);
            $resultMsg = $secondLogin['login']['result'];
            if ($resultMsg != "Success") {
                throw new SessionException("Wiki login failed: $resultMsg");
            }
            $this->tokencache['login'] =  $firstlogin['login']['token'];
        }
    }
public function login ( $ username , $ password ) { $ credentials = array ( 'lgname' => $ username , 'lgpassword' => $ password ) ; $ firstlogin = $ this -> client -> login ( $ credentials ) ; $ this -> failOnError ( "Wiki login failed." , $ firstlogin ) ; $ resultMsg = $ firstlogin [ 'login' ] [ 'result' ] ; if ( $ resultMsg != "NeedToken" && $ resultMsg != "Success" ) { throw new SessionException ( "Wiki login failed: $resultMsg" ) ; } if ( $ resultMsg == "NeedToken" ) { $ secondLogin = $ this -> client -> login ( array_merge ( array ( 'lgtoken' => $ firstlogin [ 'login' ] [ 'token' ] ) , $ credentials ) ) ; $ this -> failOnError ( "Wiki login failed." , $ secondLogin ) ; $ resultMsg = $ secondLogin [ 'login' ] [ 'result' ] ; if ( $ resultMsg != "Success" ) { throw new SessionException ( "Wiki login failed: $resultMsg" ) ; } $ this -> tokencache [ 'login' ] = $ firstlogin [ 'login' ] [ 'token' ] ; } }
Perform API login

If the API needs a token for logging in, the login is performed twice.

@param string $username
@param string $password
@throws SessionException
Perform API login