mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-01 20:04:51 +02:00
fixes #2450 add user agent in activities performed with api key
Updated user activity display to show when a user is connected via API key, including an icon and updated tooltip. Modified backend to set a 'connected_with' flag in activity details when API key authentication is used.
This commit is contained in:
@@ -481,7 +481,7 @@ function lineConstructor(line) {
|
||||
|
||||
/* Detail_section */
|
||||
newLine.find(".detail-item-1").html(line.ip_address);
|
||||
newLine.find(".detail-item-1").attr("title", "IP");
|
||||
newLine.find(".detail-item-1").attr("title", "IP: " + line.ip_address);
|
||||
|
||||
if (line.detailsType == "script") {
|
||||
newLine.find(".detail-item-2").html(line.details.script);
|
||||
@@ -492,8 +492,10 @@ function lineConstructor(line) {
|
||||
}
|
||||
|
||||
if (line.details.agent) {
|
||||
newLine.find(".detail-item-3").html(line.details.agent);
|
||||
newLine.find(".detail-item-3").attr('title', line.details.agent);
|
||||
const api_key = line.details.connected_with ? 'API Key, ' : '';
|
||||
const details = line.details.connected_with ? '<i class="icon-key"></i>' + line.details.agent : line.details.agent;
|
||||
newLine.find(".detail-item-3").html(details);
|
||||
newLine.find(".detail-item-3").attr('title', api_key + 'User-Agent: ' + line.details.agent);
|
||||
} else if (line.details.users && line.action != "logout" && line.action != "login") {
|
||||
const user_string = [...new Set(line.details.users)].toString();
|
||||
newLine.find(".detail-item-3").html(user_string);
|
||||
|
||||
@@ -603,6 +603,12 @@ function pwg_activity($object, $object_id, $action, $details=array())
|
||||
$user_agent = strip_tags($_SERVER['HTTP_USER_AGENT']);
|
||||
}
|
||||
|
||||
if (isset($_SESSION['connected_with']) and 'api_key' === $_SESSION['connected_with'] and isset($_SERVER['HTTP_USER_AGENT']))
|
||||
{
|
||||
$details['connected_with'] = 'api_key';
|
||||
$user_agent = strip_tags($_SERVER['HTTP_USER_AGENT']);
|
||||
}
|
||||
|
||||
// we want to know if the login is automatic with remember_me (auto_login)
|
||||
// or with an authentication key provided in the URL (auth_key_login)
|
||||
if ('user' == $object and 'login' == $action)
|
||||
|
||||
Reference in New Issue
Block a user