Authentication: Minor improvements in bad username handling, effort to integrate messages.
This commit is contained in:
parent
a7ecdf72f8
commit
b23a18fdf1
|
|
@ -107,7 +107,7 @@ class plugin_database {
|
|||
$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']);
|
||||
if (!empty($_SESSION['username'])) {
|
||||
if (!empty($_SESSION['authentication']['plugin']['database']['authorized']) && $_SESSION['authentication']['plugin']['database']['authorized'] == 1 && !empty($_SESSION['username'])) {
|
||||
$view->assign("login_password_description", $text['label-password_description']);
|
||||
$view->assign("username", $_SESSION['username']);
|
||||
$view->assign("button_cancel", $text['button-cancel']);
|
||||
|
|
@ -286,6 +286,9 @@ class plugin_database {
|
|||
|
||||
}
|
||||
}
|
||||
else {
|
||||
unset($_SESSION['username'], $_REQUEST['username'], $_POST['username'], $this->username);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,6 +100,9 @@ class plugin_email {
|
|||
$view->assign("login_logo_source", $settings['theme']['logo']);
|
||||
$view->assign("button_login", $text['button-login']);
|
||||
|
||||
//messages
|
||||
$view->assign('messages', message::html(true, ' '));
|
||||
|
||||
//show the views
|
||||
$content = $view->render('username.htm');
|
||||
echo $content;
|
||||
|
|
@ -145,8 +148,23 @@ class plugin_email {
|
|||
$_SESSION["user_email"] = $row['user_email'];
|
||||
$_SESSION["contact_uuid"] = $row["contact_uuid"];
|
||||
|
||||
//user not found
|
||||
if (empty($row) || !is_array($row) || @sizeof($row) == 0) {
|
||||
//clear submitted usernames
|
||||
unset($this->username, $_SESSION['username'], $_POST['username']);
|
||||
|
||||
//build the result array
|
||||
$result["plugin"] = "totp";
|
||||
$result["domain_uuid"] = $_SESSION["domain_uuid"];
|
||||
$result["domain_name"] = $_SESSION["domain_name"];
|
||||
$result["authorized"] = false;
|
||||
|
||||
//retun the array
|
||||
return $result;
|
||||
}
|
||||
|
||||
//user email not found
|
||||
if (empty($row["user_email"])) {
|
||||
else if (empty($row["user_email"])) {
|
||||
//build the result array
|
||||
$result["plugin"] = "email";
|
||||
$result["domain_name"] = $_SESSION["domain_name"];
|
||||
|
|
@ -284,6 +302,9 @@ class plugin_email {
|
|||
$view->assign("button_cancel", $text['button-cancel']);
|
||||
}
|
||||
|
||||
//messages
|
||||
$view->assign('messages', message::html(true, ' '));
|
||||
|
||||
//show the views
|
||||
$content = $view->render('email.htm');
|
||||
echo $content;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ class plugin_totp {
|
|||
$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;
|
||||
|
||||
//get the username
|
||||
if (isset($_SESSION["username"])) {
|
||||
|
|
@ -106,6 +107,10 @@ class plugin_totp {
|
|||
$view->assign("login_logo_source", $settings['theme']['logo']);
|
||||
$view->assign("button_login", $text['button-login']);
|
||||
$view->assign("favicon", $settings['theme']['favicon']);
|
||||
$view->assign("message_delay", $settings['theme']['message_delay']);
|
||||
|
||||
//messages
|
||||
$view->assign('messages', message::html(true, ' '));
|
||||
|
||||
//show the views
|
||||
$content = $view->render('username.htm');
|
||||
|
|
@ -146,6 +151,19 @@ class plugin_totp {
|
|||
$parameters['username'] = $this->username;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (empty($row) || !is_array($row) || @sizeof($row) == 0) {
|
||||
//clear submitted usernames
|
||||
unset($this->username, $_SESSION['username'], $_POST['username']);
|
||||
|
||||
//build the result array
|
||||
$result["plugin"] = "totp";
|
||||
$result["domain_uuid"] = $_SESSION["domain_uuid"];
|
||||
$result["domain_name"] = $_SESSION["domain_name"];
|
||||
$result["authorized"] = false;
|
||||
|
||||
//retun the array
|
||||
return $result;
|
||||
}
|
||||
unset($parameters);
|
||||
|
||||
//set class variables
|
||||
|
|
@ -261,6 +279,9 @@ class plugin_totp {
|
|||
$view->assign("button_next", $text['button-next']);
|
||||
$view->assign("favicon", $settings['theme']['favicon']);
|
||||
|
||||
//messages
|
||||
$view->assign('messages', message::html(true, ' '));
|
||||
|
||||
//render the template
|
||||
$content = $view->render('totp_secret.htm');
|
||||
}
|
||||
|
|
@ -268,6 +289,9 @@ class plugin_totp {
|
|||
//assign values to the template
|
||||
$view->assign("button_verify", $text['label-verify']);
|
||||
|
||||
//messages
|
||||
$view->assign('messages', message::html(true, ' '));
|
||||
|
||||
//render the template
|
||||
$content = $view->render('totp.htm');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,59 @@
|
|||
<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=''>
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@
|
|||
{/literal}
|
||||
|
||||
</script>
|
||||
|
||||
<title>{$login_title}</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
@ -63,7 +62,7 @@
|
|||
<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}'>
|
||||
<form method='post' name='frm' action=''>
|
||||
<div class='login_text'>
|
||||
{if !empty($username)}
|
||||
{$login_password_description}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,59 @@
|
|||
<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=''>
|
||||
|
|
|
|||
|
|
@ -7,13 +7,62 @@
|
|||
<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}'>
|
||||
<form method='post' name='frm' action=''>
|
||||
<div>
|
||||
<input type='text' class='txt login' style='text-align: center; min-width: 200px; width: 200px; margin-bottom: 8px;' name='username' id='username' placeholder="{$login_username}" /><br />
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue