www/src/rootio/Bundle/vmailmeBundle/Lib/RoundcubeLogin.php
/**
     * Login to Roundcube using the IMAP username/password
     *
     * Note: If the function detects that we're already logged in,
     *       it performs a re-login, i.e. a logout/login-combination to ensure
     *       that the specified user is logged in.
     *
     *       If you don't want this, use the isLoggedIn()-function and redirect
     *       the RC without calling login().
     *
     * @param string IMAP username
     * @param string IMAP password (plain text)
     * @return boolean Returns TRUE if the login was successful, FALSE otherwise
     * @throws RoundcubeLoginException
     */
Login to Roundcube using the IMAP username/password
Note: If the function detects that we're already logged in,
it performs a re-login, i.e. a logout/login-combination to ensure
that the specified user is logged in.

If you don't want this, use the isLoggedIn()-function and redirect
the RC without calling login().

@param string IMAP username
@param string IMAP password (plain text)
@return boolean Returns TRUE if the login was successful, FALSE otherwise
@throws RoundcubeLoginException
Login to Roundcube using the IMAP username / password Note : If the function detects that we ' re already logged in it performs a re - login i . e . a logout / login - combination to ensure that the specified user is logged in . If you don ' t want this use the isLoggedIn () - function and redirect the RC without calling login () . @param string IMAP username @param string IMAP password ( plain text ) @return boolean Returns TRUE if the login was successful FALSE otherwise @throws RoundcubeLoginException
public function login($username,$password) {
        $this->updateLoginStatus();
        if ($this->isLoggedIn())
            $this->logout();
        $data = (($this->lastToken) ? "_token=".$this->lastToken."&" : "")
              . "_task=login&_action=login&_timezone=1&_dstactive=1&_url=&_user=".urlencode($username)."&_pass=".urlencode($password);
        $response = $this->sendRequest($this->rcPath, $data);
        if (preg_match('/^Location\:.+_task=/mi',$response)) {
            $this->addDebug("LOGIN SUCCESSFUL","RC sent a redirection to ./?_task=..., that means we did it!");
            $this->rcLoginStatus = 1;
        }
        else if (preg_match('/^Set-Cookie:.+sessauth=-del-;/mi',$response)) {
            header($line, false);
            $this->addDebug("LOGIN FAILED","RC sent 'sessauth=-del-'; User/Pass combination wrong.");
            $this->rcLoginStatus = -1;
        }
        else {
            $this->addDebug("LOGIN STATUS UNKNOWN","Neither failure nor success. This maybe the case if no session ID was sent");
            throw new RoundcubeLoginException("Unable to determine login-status due to technical problems.");
        }
        return $this->isLoggedIn();
    }
public function login ( $ username , $ password ) { $ this -> updateLoginStatus ( ) ; if ( $ this -> isLoggedIn ( ) ) $ this -> logout ( ) ; $ data = ( ( $ this -> lastToken ) ? " _token= " . $ this -> lastToken . " & " : " " ) . " _task=login&_action=login&_timezone=1&_dstactive=1&_url=&_user= " . urlencode ( $ username ) . " &_pass= " . urlencode ( $ password ) ; $ response = $ this -> sendRequest ( $ this -> rcPath , $ data ) ; if ( preg_match ( '/^Location\:.+_task=/mi' , $ response ) ) { $ this -> addDebug ( " LOGIN SUCCESSFUL " , " RC sent a redirection to ./?_task=..., that means we did it! " ) ; $ this -> rcLoginStatus = 1 ; } else if ( preg_match ( '/^Set-Cookie:.+sessauth=-del-;/mi' , $ response ) ) { header ( $ line , false ) ; $ this -> addDebug ( " LOGIN FAILED " , " RC sent 'sessauth=-del-'; User/Pass combination wrong. " ) ; $ this -> rcLoginStatus = - 1 ; } else { $ this -> addDebug ( " LOGIN STATUS UNKNOWN " , " Neither failure nor success. This maybe the case if no session ID was sent " ) ; throw new RoundcubeLoginException ( " Unable to determine login-status due to technical problems. " ) ; } return $ this -> isLoggedIn ( ) ; }
Login to Roundcube using the IMAP username/password
 Note: If the function detects that we're already logged in,
       it performs a re-login, i.e.
Login to Roundcube using the IMAP username / password Note : If the function detects that we ' re already logged in it performs a re - login i . e .
// If already logged in, perform a re-login (logout first) // Try login //  Login successful! A redirection to ./?_task=... is a success! // Login failure detected! If the login failed, RC sends the cookie "sessauth=-del-" // Unkown, neither failure nor success. // This maybe the case if no session ID was sent