mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 18:21:39 +09:00
Add Session::getGenericToken() for general-purpose token handling
This commit is contained in:
parent
81511e47b1
commit
a0f2388842
2 changed files with 28 additions and 0 deletions
|
|
@ -373,6 +373,7 @@ class Session
|
|||
$_SESSION['RHYMIX']['timezone'] = DateTime::getTimezoneForCurrentUser();
|
||||
$_SESSION['RHYMIX']['secret'] = Security::getRandom(32, 'alnum');
|
||||
$_SESSION['RHYMIX']['tokens'] = array();
|
||||
$_SESSION['RHYMIX']['token'] = false;
|
||||
$_SESSION['is_webview'] = self::_isBuggyUserAgent();
|
||||
$_SESSION['is_new_session'] = true;
|
||||
$_SESSION['is_logged'] = false;
|
||||
|
|
@ -842,6 +843,26 @@ class Session
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a generic token that is not restricted to any particular key.
|
||||
*
|
||||
* @return string|false
|
||||
*/
|
||||
public static function getGenericToken()
|
||||
{
|
||||
if (!self::isStarted())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$_SESSION['RHYMIX']['token'])
|
||||
{
|
||||
$_SESSION['RHYMIX']['token'] = self::createToken('');
|
||||
}
|
||||
|
||||
return $_SESSION['RHYMIX']['token'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a token that can only be verified in the same session.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue