Email.php
public function authorizeWithEmail($hashedEmail, $hashedPassword, $remember = null, & $user = null)
    {
        // Status code
        $result = new EmailStatus(0);

        // Check if this email is registered
        if (dbQuery($this->dbTable)->where($this->dbHashEmailField, $hashedEmail)->first($user)) {
            $dbTable = $this->dbTable;

            $hashPasswordField = $dbTable::$_attributes[$this->dbHashPasswordField];
            // Check if passwords match
            if ($user[$hashPasswordField] === $hashedPassword) {
                $result = new EmailStatus(EmailStatus::SUCCESS_EMAIL_AUTHORIZE);

                // Login with current user
                $this->authorize($user, $remember);

            } else { // Wrong password
                $result = new EmailStatus(EmailStatus::ERROR_EMAIL_AUTHORIZE_WRONGPWD);
            }
        } else { // Email not found
            $result = new EmailStatus(EmailStatus::ERROR_EMAIL_AUTHORIZE_NOTFOUND);
        }

        // Call external authorize handler if present
        if (is_callable($this->authorizeHandler)) {
            // Call external handler - if it fails - return false
            if (!call_user_func_array($this->authorizeHandler, array(&$user, &$result))) {
                $result = new EmailStatus(EmailStatus::ERROR_EMAIL_AUTHORIZE_HANDLER);
            }
        }

        return $result;
    }
public function authorizeWithEmail($hashedEmail, $hashedPassword, $remember = null, & $user = null)
    {
        // Status code
        $result = new EmailStatus(0);

        // Check if this email is registered
        if (dbQuery($this->dbTable)->where($this->dbHashEmailField, $hashedEmail)->first($user)) {
            $dbTable = $this->dbTable;

            $hashPasswordField = $dbTable::$_attributes[$this->dbHashPasswordField];
            // Check if passwords match
            if ($user[$hashPasswordField] === $hashedPassword) {
                $result = new EmailStatus(EmailStatus::SUCCESS_EMAIL_AUTHORIZE);

                // Login with current user
                $this->authorize($user, $remember);

            } else { // Wrong password
                $result = new EmailStatus(EmailStatus::ERROR_EMAIL_AUTHORIZE_WRONGPWD);
            }
        } else { // Email not found
            $result = new EmailStatus(EmailStatus::ERROR_EMAIL_AUTHORIZE_NOTFOUND);
        }

        // Call external authorize handler if present
        if (is_callable($this->authorizeHandler)) {
            // Call external handler - if it fails - return false
            if (!call_user_func_array($this->authorizeHandler, array(&$user, &$result))) {
                $result = new EmailStatus(EmailStatus::ERROR_EMAIL_AUTHORIZE_HANDLER);
            }
        }

        return $result;
    }
public function authorizeWithEmail ( $ hashedEmail , $ hashedPassword , $ remember = null , & $ user = null ) { // Status code $ result = new EmailStatus ( 0 ) ; // Check if this email is registered if ( dbQuery ( $ this -> dbTable ) -> where ( $ this -> dbHashEmailField , $ hashedEmail ) -> first ( $ user ) ) { $ dbTable = $ this -> dbTable ; $ hashPasswordField = $ dbTable :: $ _attributes [ $ this -> dbHashPasswordField ] ; // Check if passwords match if ( $ user [ $ hashPasswordField ] === $ hashedPassword ) { $ result = new EmailStatus ( EmailStatus :: SUCCESS_EMAIL_AUTHORIZE ) ; // Login with current user $ this -> authorize ( $ user , $ remember ) ; } else { // Wrong password $ result = new EmailStatus ( EmailStatus :: ERROR_EMAIL_AUTHORIZE_WRONGPWD ) ; } } else { // Email not found $ result = new EmailStatus ( EmailStatus :: ERROR_EMAIL_AUTHORIZE_NOTFOUND ) ; } // Call external authorize handler if present if ( is_callable ( $ this -> authorizeHandler ) ) { // Call external handler - if it fails - return false if ( ! call_user_func_array ( $ this -> authorizeHandler , array ( & $ user , & $ result ) ) ) { $ result = new EmailStatus ( EmailStatus :: ERROR_EMAIL_AUTHORIZE_HANDLER ) ; } } return $ result ; }
Authorize user via email.

@param string $hashedEmail       Hashed user email
@param string $hashedPassword    Hashed user password
@param boolean $remember         Remember checkbox
@param mixed  $user              Variable to return created user object

@return EmailStatus Status object value
Authorize user via email .