Add an endpoint to refresh the token
Useful for AJAX requests which burns the token
This commit is contained in:
parent
8b27824338
commit
986a521067
2 changed files with 13 additions and 0 deletions
|
@ -45,6 +45,8 @@ class Router
|
|||
|
||||
public static $PAGE_SAVE_PLUGINSADMIN = 'save_pluginadmin';
|
||||
|
||||
public static $GET_TOKEN = 'token';
|
||||
|
||||
/**
|
||||
* Reproducing renderPage() if hell, to avoid regression.
|
||||
*
|
||||
|
@ -142,6 +144,10 @@ public static function findPage($query, $get, $loggedIn)
|
|||
return self::$PAGE_SAVE_PLUGINSADMIN;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do='. self::$GET_TOKEN)) {
|
||||
return self::$GET_TOKEN;
|
||||
}
|
||||
|
||||
return self::$PAGE_LINKLIST;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1582,6 +1582,13 @@ function($a, $b) { return $a['order'] - $b['order']; }
|
|||
exit;
|
||||
}
|
||||
|
||||
// Get a fresh token
|
||||
if ($targetPage == Router::$GET_TOKEN) {
|
||||
header('Content-Type:text/plain');
|
||||
echo getToken($conf);
|
||||
exit;
|
||||
}
|
||||
|
||||
// -------- Otherwise, simply display search form and links:
|
||||
showLinkList($PAGE, $LINKSDB, $conf, $pluginManager);
|
||||
exit;
|
||||
|
|
Loading…
Reference in a new issue