library/Garp/Auth/Adapter/Passwordless.php
public function acceptToken($token, $uid) {
        if (!$token || !$uid) {
            $this->_addError(__('Insufficient data received'));
            return false;
        }
        $authPwlessModel = $this->_getPasswordlessModel();
        $select = $authPwlessModel->select()
            ->where('`token` = ?', $token)
            ->where('user_id = ?', $uid);

        $row = $authPwlessModel->fetchRow($select);
        if (!$row || !$row->Model_User) {
            $this->_addError(__('passwordless token not found'));
            return false;
        }

        // Check wether the user is already logged in. Let's not inconvenience them
        // with security when it's not that important
        if ($this->_userIsAlreadyLoggedIn($row)) {
            return $row->Model_User;
        }

        if (!$this->_tokenIsValid($row)) {
            return false;
        }

        $authPwlessModel->getObserver('Authenticatable')->updateLoginStats(
            $row->Model_User->id, array(
                'claimed' => 1
            )
        );

        return $row->Model_User;
    }
public function acceptToken($token, $uid) {
        if (!$token || !$uid) {
            $this->_addError(__('Insufficient data received'));
            return false;
        }
        $authPwlessModel = $this->_getPasswordlessModel();
        $select = $authPwlessModel->select()
            ->where('`token` = ?', $token)
            ->where('user_id = ?', $uid);

        $row = $authPwlessModel->fetchRow($select);
        if (!$row || !$row->Model_User) {
            $this->_addError(__('passwordless token not found'));
            return false;
        }

        // Check wether the user is already logged in. Let's not inconvenience them
        // with security when it's not that important
        if ($this->_userIsAlreadyLoggedIn($row)) {
            return $row->Model_User;
        }

        if (!$this->_tokenIsValid($row)) {
            return false;
        }

        $authPwlessModel->getObserver('Authenticatable')->updateLoginStats(
            $row->Model_User->id, array(
                'claimed' => 1
            )
        );

        return $row->Model_User;
    }
public function acceptToken ( $ token , $ uid ) { if ( ! $ token || ! $ uid ) { $ this -> _addError ( __ ( 'Insufficient data received' ) ) ; return false ; } $ authPwlessModel = $ this -> _getPasswordlessModel ( ) ; $ select = $ authPwlessModel -> select ( ) -> where ( '`token` = ?' , $ token ) -> where ( 'user_id = ?' , $ uid ) ; $ row = $ authPwlessModel -> fetchRow ( $ select ) ; if ( ! $ row || ! $ row -> Model_User ) { $ this -> _addError ( __ ( 'passwordless token not found' ) ) ; return false ; } // Check wether the user is already logged in. Let's not inconvenience them // with security when it's not that important if ( $ this -> _userIsAlreadyLoggedIn ( $ row ) ) { return $ row -> Model_User ; } if ( ! $ this -> _tokenIsValid ( $ row ) ) { return false ; } $ authPwlessModel -> getObserver ( 'Authenticatable' ) -> updateLoginStats ( $ row -> Model_User -> id , array ( 'claimed' => 1 ) ) ; return $ row -> Model_User ; }
Accept a user token

@param string $token
@param int $uid User id
@return Garp_Model_Db Logged in user
Accept a user token