enforce non-empty name and token/password on access tokens until better checks are instituted.
This commit is contained in:
parent
7ee7f00bf3
commit
f666d8a083
@ -121,15 +121,22 @@ class Settings extends \Zotlabs\Web\Controller {
|
||||
|
||||
if((argc() > 1) && (argv(1) == 'tokens')) {
|
||||
check_form_security_token_redirectOnErr('/settings/tokens', 'settings_tokens');
|
||||
|
||||
$atoken_id = (($_POST['atoken_id']) ? intval($_POST['atoken_id']) : 0);
|
||||
$name = trim(escape_tags($_POST['name']));
|
||||
$token = trim($_POST['token']);
|
||||
if(trim($_POST['expires']))
|
||||
$expires = datetime_convert(date_default_timezone_get(),'UTC',$_POST['expires']);
|
||||
else
|
||||
$expires = NULL_DATE;
|
||||
|
||||
$token_errs = 0;
|
||||
if(array_key_exists('token',$_POST)) {
|
||||
$atoken_id = (($_POST['atoken_id']) ? intval($_POST['atoken_id']) : 0);
|
||||
$name = trim(escape_tags($_POST['name']));
|
||||
$token = trim($_POST['token']);
|
||||
if((! $name) || (! $token))
|
||||
$token_errs ++;
|
||||
if(trim($_POST['expires']))
|
||||
$expires = datetime_convert(date_default_timezone_get(),'UTC',$_POST['expires']);
|
||||
else
|
||||
$expires = NULL_DATE;
|
||||
}
|
||||
if($token_errs) {
|
||||
notice( t('Name and Token are required.') . EOL);
|
||||
return;
|
||||
}
|
||||
if($atoken_id) {
|
||||
$r = q("update atoken set atoken_name = '%s', atoken_token = '%s' atoken_expire = '%s'
|
||||
where atoken_id = %d and atoken_uid = %d",
|
||||
|
4231
util/hmessages.po
4231
util/hmessages.po
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user