src/Security/Member.php
public function generateAutologinTokenAndStoreHash($lifetime = null)
    {
        if ($lifetime !== null) {
            Deprecation::notice(
                '5.0',
                'Passing a $lifetime to Member::generateAutologinTokenAndStoreHash() is deprecated,
                    use the Member.auto_login_token_lifetime config setting instead',
                Deprecation::SCOPE_GLOBAL
            );
            $lifetime = (86400 * $lifetime); // Method argument is days, convert to seconds
        } else {
            $lifetime = $this->config()->auto_login_token_lifetime;
        }

        do {
            $generator = new RandomGenerator();
            $token = $generator->randomToken();
            $hash = $this->encryptWithUserSettings($token);
        } while (DataObject::get_one(Member::class, array(
            '"Member"."AutoLoginHash"' => $hash
        )));

        $this->AutoLoginHash = $hash;
        $this->AutoLoginExpired = date('Y-m-d H:i:s', time() + $lifetime);

        $this->write();

        return $token;
    }
public function generateAutologinTokenAndStoreHash($lifetime = null)
    {
        if ($lifetime !== null) {
            Deprecation::notice(
                '5.0',
                'Passing a $lifetime to Member::generateAutologinTokenAndStoreHash() is deprecated,
                    use the Member.auto_login_token_lifetime config setting instead',
                Deprecation::SCOPE_GLOBAL
            );
            $lifetime = (86400 * $lifetime); // Method argument is days, convert to seconds
        } else {
            $lifetime = $this->config()->auto_login_token_lifetime;
        }

        do {
            $generator = new RandomGenerator();
            $token = $generator->randomToken();
            $hash = $this->encryptWithUserSettings($token);
        } while (DataObject::get_one(Member::class, array(
            '"Member"."AutoLoginHash"' => $hash
        )));

        $this->AutoLoginHash = $hash;
        $this->AutoLoginExpired = date('Y-m-d H:i:s', time() + $lifetime);

        $this->write();

        return $token;
    }
public function generateAutologinTokenAndStoreHash ( $ lifetime = null ) { if ( $ lifetime !== null ) { Deprecation :: notice ( '5.0' , 'Passing a $lifetime to Member::generateAutologinTokenAndStoreHash() is deprecated,
                    use the Member.auto_login_token_lifetime config setting instead' , Deprecation :: SCOPE_GLOBAL ) ; $ lifetime = ( 86400 * $ lifetime ) ; // Method argument is days, convert to seconds } else { $ lifetime = $ this -> config ( ) -> auto_login_token_lifetime ; } do { $ generator = new RandomGenerator ( ) ; $ token = $ generator -> randomToken ( ) ; $ hash = $ this -> encryptWithUserSettings ( $ token ) ; } while ( DataObject :: get_one ( Member :: class , array ( '"Member"."AutoLoginHash"' => $ hash ) ) ) ; $ this -> AutoLoginHash = $ hash ; $ this -> AutoLoginExpired = date ( 'Y-m-d H:i:s' , time ( ) + $ lifetime ) ; $ this -> write ( ) ; return $ token ; }
Generate an auto login token which can be used to reset the password,
at the same time hashing it and storing in the database.

@param int|null $lifetime DEPRECATED: The lifetime of the auto login hash in days. Overrides
the Member.auto_login_token_lifetime config value
@return string Token that should be passed to the client (but NOT persisted).
Generate an auto login token which can be used to reset the password at the same time hashing it and storing in the database .