From a12425629e68c51a2f05c3f1cfa990e694ea0424 Mon Sep 17 00:00:00 2001 From: plegall Date: Fri, 29 Jan 2016 12:44:38 +0100 Subject: fixes #412, warn visitor if auth key no longer valid --- include/common.inc.php | 10 ++++++++++ include/functions_user.inc.php | 1 + language/en_UK/common.lang.php | 1 + language/fr_FR/common.lang.php | 3 ++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/common.inc.php b/include/common.inc.php index e5c2b8e3e..a01fced8a 100644 --- a/include/common.inc.php +++ b/include/common.inc.php @@ -201,6 +201,16 @@ if (is_a_guest()) $user['username'] = l10n('guest'); } +// in case an auth key was provided and is no longer valid, we must wait to +// be here, with language loaded, to prepare the message +if (isset($page['auth_key_invalid']) and $page['auth_key_invalid']) +{ + $page['errors'][] = + l10n('Your authentication key is no longer valid.') + .sprintf(' %s', get_root_url().'identification.php', l10n('Login')) + ; +} + // template instance if (defined('IN_ADMIN') and IN_ADMIN ) {// Admin template diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php index 2b9d48752..340bca9cb 100644 --- a/include/functions_user.inc.php +++ b/include/functions_user.inc.php @@ -1506,6 +1506,7 @@ SELECT // is the key still valid? if (strtotime($key['expired_on']) < strtotime($key['dbnow'])) { + $page['auth_key_invalid'] = true; return false; } diff --git a/language/en_UK/common.lang.php b/language/en_UK/common.lang.php index 9e4c5236b..bf61456ed 100644 --- a/language/en_UK/common.lang.php +++ b/language/en_UK/common.lang.php @@ -425,4 +425,5 @@ $lang['Photo description'] = 'Photo description'; $lang['Album name, A → Z'] = 'Album name, A → Z'; $lang['Album name, Z → A'] = 'Album name, Z → A'; $lang['Link: %s'] = 'Link: %s'; +$lang['Your authentication key is no longer valid.'] = 'Your authentication key is no longer valid.'; ?> \ No newline at end of file diff --git a/language/fr_FR/common.lang.php b/language/fr_FR/common.lang.php index d797cdaf7..5eac3c004 100644 --- a/language/fr_FR/common.lang.php +++ b/language/fr_FR/common.lang.php @@ -424,4 +424,5 @@ $lang['Photo title'] = 'Titre de la photo'; $lang['Photo description'] = 'Description de la photo'; $lang['Album name, A → Z'] = 'Nom de l\'album, A → Z'; $lang['Album name, Z → A'] = 'Nom de l\'album, Z → A'; -$lang['Link: %s'] = 'Lien: %s'; \ No newline at end of file +$lang['Link: %s'] = 'Lien: %s'; +$lang['Your authentication key is no longer valid.'] = 'Votre clef d\'identification n\'est plus valide.'; \ No newline at end of file -- cgit v1.2.3