public static function get_autologin_key() {
        global $USER;
        // Delete previous keys.
        delete_user_key('tool_mobile', $USER->id);

        // Create a new key.
        $iprestriction = getremoteaddr();
        $validuntil = time() + self::LOGIN_KEY_TTL;
        return create_user_key('tool_mobile', $USER->id, null, $iprestriction, $validuntil);
    }
public static function get_autologin_key() {
        global $USER;
        // Delete previous keys.
        delete_user_key('tool_mobile', $USER->id);

        // Create a new key.
        $iprestriction = getremoteaddr();
        $validuntil = time() + self::LOGIN_KEY_TTL;
        return create_user_key('tool_mobile', $USER->id, null, $iprestriction, $validuntil);
    }
public static function get_autologin_key ( ) { global $ USER ; // Delete previous keys. delete_user_key ( 'tool_mobile' , $ USER -> id ) ; // Create a new key. $ iprestriction = getremoteaddr ( ) ; $ validuntil = time ( ) + self :: LOGIN_KEY_TTL ; return create_user_key ( 'tool_mobile' , $ USER -> id , null , $ iprestriction , $ validuntil ) ; }
Creates an auto-login key for the current user, this key is restricted by time and ip address.

@return string the key
@since Moodle 3.2
Creates an auto - login key for the current user this key is restricted by time and ip address .