public function authorize(RecordInterface &$user, $remember = false)
    {
        // Call default authorize behaviour
        if (parent::authorize($user, $remember)) {
            // If remember flag is passed - save it
            if ($remember) {
                // Create token
                $token = $user[$this->dbHashEmailField].(time()+($this->cookieTime)).$user[$this->dbHashPasswordField];
                // Set db accessToken
                $user[$this->dbAccessToken] = $token;
                $user->save();
                // Set cookies with token
                $expiry = time()+($this->cookieTime);
                $cookieData = array( "token" => $token, "expiry" => $expiry );
                setcookie('_cookie_accessToken', serialize($cookieData), $expiry);
            }
        }
    }
public function authorize(RecordInterface &$user, $remember = false)
    {
        // Call default authorize behaviour
        if (parent::authorize($user, $remember)) {
            // If remember flag is passed - save it
            if ($remember) {
                // Create token
                $token = $user[$this->dbHashEmailField].(time()+($this->cookieTime)).$user[$this->dbHashPasswordField];
                // Set db accessToken
                $user[$this->dbAccessToken] = $token;
                $user->save();
                // Set cookies with token
                $expiry = time()+($this->cookieTime);
                $cookieData = array( "token" => $token, "expiry" => $expiry );
                setcookie('_cookie_accessToken', serialize($cookieData), $expiry);
            }
        }
    }
public function authorize ( RecordInterface & $ user , $ remember = false ) { // Call default authorize behaviour if ( parent :: authorize ( $ user , $ remember ) ) { // If remember flag is passed - save it if ( $ remember ) { // Create token $ token = $ user [ $ this -> dbHashEmailField ] . ( time ( ) + ( $ this -> cookieTime ) ) . $ user [ $ this -> dbHashPasswordField ] ; // Set db accessToken $ user [ $ this -> dbAccessToken ] = $ token ; $ user -> save ( ) ; // Set cookies with token $ expiry = time ( ) + ( $ this -> cookieTime ) ; $ cookieData = array ( "token" => $ token , "expiry" => $ expiry ) ; setcookie ( '_cookie_accessToken' , serialize ( $ cookieData ) , $ expiry ) ; } } }
User authorization handler
User authorization handler