mirror of
https://codeberg.org/SeedDMS/paperless
synced 2025-02-06 15:05:46 +00:00
set live time of token from settings
This commit is contained in:
parent
58e864f0b6
commit
9bff27abfc
|
@ -159,7 +159,11 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
|
|||
else {
|
||||
if(!empty($settings->_extensions['paperless']['jwtsecret'])) {
|
||||
$token = new SeedDMS_JwtToken($settings->_extensions['paperless']['jwtsecret']);
|
||||
if(!$tokenstr = $token->jwtEncode($userobj->getId().':'.(time()+84600))) {
|
||||
if(!empty($settings->_extensions['paperless']['tokenlivetime']))
|
||||
$days = (int) $settings->_extensions['paperless']['tokenlivetime'];
|
||||
else
|
||||
$days = 1000;
|
||||
if(!$tokenstr = $token->jwtEncode($userobj->getId().':'.(time()+$days*84600))) {
|
||||
return $response->withStatus(403);
|
||||
}
|
||||
return $response->withJson(array('token'=>$tokenstr), 200);
|
||||
|
|
Loading…
Reference in New Issue
Block a user