only log if api key was reset on purpose
This commit is contained in:
parent
d2e59e8f86
commit
807e420883
|
@ -49,7 +49,7 @@ function user_controller() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_source['api_key'] == "")
|
if ($user_source['api_key'] == "")
|
||||||
User_reset_api_key($user_source);
|
User_reset_api_key($user_source, false);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
$user_source['Nick'],
|
$user_source['Nick'],
|
||||||
|
|
|
@ -191,12 +191,13 @@ function User_by_password_recovery_token($token) {
|
||||||
*
|
*
|
||||||
* @param User $user
|
* @param User $user
|
||||||
*/
|
*/
|
||||||
function User_reset_api_key(&$user) {
|
function User_reset_api_key(&$user, $log = true) {
|
||||||
$user['api_key'] = md5($user['Nick'] . time() . rand());
|
$user['api_key'] = md5($user['Nick'] . time() . rand());
|
||||||
$result = sql_query("UPDATE `User` SET `api_key`='" . sql_escape($user['api_key']) . "' WHERE `UID`='" . sql_escape($user['UID']) . "' LIMIT 1");
|
$result = sql_query("UPDATE `User` SET `api_key`='" . sql_escape($user['api_key']) . "' WHERE `UID`='" . sql_escape($user['UID']) . "' LIMIT 1");
|
||||||
if ($result === false)
|
if ($result === false)
|
||||||
return false;
|
return false;
|
||||||
engelsystem_log(sprintf("API key resetted (%s).",User_Nick_render($user)));
|
if ($log)
|
||||||
|
engelsystem_log(sprintf("API key resetted (%s).",User_Nick_render($user)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -749,7 +749,7 @@ function view_user_shifts() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user['api_key'] == "")
|
if ($user['api_key'] == "")
|
||||||
User_reset_api_key($user);
|
User_reset_api_key($user, false);
|
||||||
|
|
||||||
return page(array(
|
return page(array(
|
||||||
'<div class="col-md-12">',
|
'<div class="col-md-12">',
|
||||||
|
|
Loading…
Reference in New Issue