Login: Restore authentication failed message.

This commit is contained in:
fusionate
2023-06-17 23:16:39 +00:00
parent 8393701d13
commit 3021f59431
6 changed files with 84 additions and 30 deletions
@@ -53,7 +53,7 @@ class authentication {
foreach ($_SESSION['authentication']['methods'] as $name) {
//already processed the plugin move to the next plugin
if ($_SESSION['authentication']['plugin'][$name]['authorized']) {
if (!empty($_SESSION['authentication']['plugin']) && $_SESSION['authentication']['plugin'][$name]['authorized']) {
continue;
}
@@ -32,6 +32,7 @@ class plugin_database {
$settings['theme']['logo'] = !empty($_SESSION['theme']['logo']['text']) ? $_SESSION['theme']['logo']['text'] : PROJECT_PATH.'/themes/default/images/logo_login.png';
$settings['theme']['login_logo_width'] = !empty($_SESSION['theme']['login_logo_width']['text']) ? $_SESSION['theme']['login_logo_width']['text'] : 'auto; max-width: 300px';
$settings['theme']['login_logo_height'] = !empty($_SESSION['theme']['login_logo_height']['text']) ? $_SESSION['theme']['login_logo_height']['text'] : 'auto; max-height: 300px';
$settings['theme']['message_delay'] = isset($_SESSION['theme']['message_delay']) ? 1000 * (float) $_SESSION['theme']['message_delay'] : 3000;
//already authorized
if (isset($_SESSION['authentication']['plugin']['database']) && $_SESSION['authentication']['plugin']['database']["authorized"]) {
@@ -81,6 +82,10 @@ class plugin_database {
$view->assign("login_logo_width", $settings['theme']['login_logo_width']);
$view->assign("login_logo_height", $settings['theme']['login_logo_height']);
$view->assign("login_logo_source", $settings['theme']['logo']);
$view->assign("message_delay", $settings['theme']['message_delay']);
//messages
$view->assign('messages', message::html(true, ' '));
//add the token name and hash to the view
//$view->assign("token_name", $token['name']);
@@ -7,10 +7,60 @@
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<link rel='stylesheet' type='text/css' href='{$project_path}/themes/default/css.php' />
<link rel='icon' href='{$favicon}'>
<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/jquery/jquery.min.js.php'></script>
<script language='JavaScript' type='text/javascript'>
//message bar display
{literal}
function display_message(msg, mood, delay) {
mood = mood !== undefined ? mood : 'default';
delay = delay !== undefined ? delay : {/literal}{$message_delay}{literal};
if (msg !== '') {
var message_text = $(document.createElement('div'));
message_text.addClass('message_text message_mood_'+mood);
message_text.html(msg);
message_text.on('click', function() {
var object = $(this);
object.clearQueue().finish();
$('#message_container div').remove();
$('#message_container').css({opacity: 0, 'height': 0}).css({'height': 'auto'});
} );
$('#message_container').append(message_text);
message_text.css({'height': 'auto'}).animate({opacity: 1}, 250, function(){
$('#message_container').delay(delay).animate({opacity: 0, 'height': 0}, 500, function() {
$('#message_container div').remove();
$('#message_container').animate({opacity: 1}, 300).css({'height': 'auto'});
});
});
}
}
{/literal}
{literal}
$(document).ready(function() {
{/literal}
{$messages}
//message bar hide on hover
{literal}
$('#message_container').on('mouseenter',function() {
$('#message_container div').remove();
$('#message_container').css({opacity: 0, 'height': 0}).css({'height': 'auto'});
});
{/literal}
{literal}
}); //document ready end
{/literal}
</script>
<title>{$login_title}</title>
</head>
<body>
<div id='page' align='center'>
<div id='message_container'></div>
<div id='default_login'>
<a href='{$project_path}/'><img id='login_logo' style='width: {$login_logo_width}; height: {$login_logo_height};' src='{$login_logo_source}' /></a><br />
<form method='post' name='frm' action='{$login_destination_url}'>