Merge branch 'ent-10326-bearer-token-permite-conectar-con-pandora1234-por-defecto' into 'develop'

Ent 10326 bearer token permite conectar con pandora1234 por defecto

See merge request artica/pandorafms!5782
This commit is contained in:
Matias Didier 2023-05-19 07:00:38 +00:00
commit 2db1eddc11
2 changed files with 11 additions and 0 deletions

View File

@ -682,6 +682,10 @@ if ($update_user) {
] ]
); );
$res3 = save_pass_history($id, $password_new); $res3 = save_pass_history($id, $password_new);
// Generate new API token.
$newToken = api_token_generate();
$res4 = update_user($id, ['api_token' => $newToken]);
} }
ui_print_result_message( ui_print_result_message(
@ -706,6 +710,10 @@ if ($update_user) {
'utimestamp' => time(), 'utimestamp' => time(),
] ]
); );
// Generate new API token.
$newToken = api_token_generate();
$res4 = update_user($id, ['api_token' => $newToken]);
} }
ui_print_result_message( ui_print_result_message(

View File

@ -9612,6 +9612,7 @@ function api_set_new_user($id, $thrash2, $other, $thrash3)
$values['section'] = $other['data'][11]; $values['section'] = $other['data'][11];
$values['session_time'] = $other['data'][12]; $values['session_time'] = $other['data'][12];
$values['metaconsole_access_node'] = $other['data'][13]; $values['metaconsole_access_node'] = $other['data'][13];
$values['api_token'] = api_token_generate();
if (empty($password) === true) { if (empty($password) === true) {
returnError('Password cannot be empty.'); returnError('Password cannot be empty.');
@ -9708,6 +9709,8 @@ function api_set_update_user($id, $thrash2, $other, $thrash3)
if (!update_user_password($id, $other['data'][4])) { if (!update_user_password($id, $other['data'][4])) {
returnError('The user could not be updated. Password info incorrect.'); returnError('The user could not be updated. Password info incorrect.');
return; return;
} else {
$values['api_token'] = api_token_generate();
} }
} }