Commit dbe860f0 authored by Franco Fichtner's avatar Franco Fichtner

login: improve look and feel

o Can't unset the session var anymore resulting in permanent
  login error message display until login was successful.
o Remove some padding and make permanent room for the error
  message so that the container doesn't grow after submit.
o Move the workaround to a permanent position in <button/>.
o Move the copyright right line right underneath the container.
parent 21136d00
...@@ -142,7 +142,8 @@ function getAllowedPages($username) { ...@@ -142,7 +142,8 @@ function getAllowedPages($username) {
} }
function session_auth() { function session_auth(&$Login_Error)
{
global $config, $_SESSION; global $config, $_SESSION;
// Handle HTTPS httponly and secure flags // Handle HTTPS httponly and secure flags
...@@ -188,7 +189,7 @@ function session_auth() { ...@@ -188,7 +189,7 @@ function session_auth() {
exit; exit;
} else { } else {
/* give the user an error message */ /* give the user an error message */
$_SESSION['Login_Error'] = gettext('Wrong username or password.'); $Login_Error = gettext('Wrong username or password.');
log_error("webConfigurator authentication error for '{$_POST['usernamefld']}' from {$_SERVER['REMOTE_ADDR']}"); log_error("webConfigurator authentication error for '{$_POST['usernamefld']}' from {$_SERVER['REMOTE_ADDR']}");
} }
} }
...@@ -251,10 +252,11 @@ function session_auth() { ...@@ -251,10 +252,11 @@ function session_auth() {
return true; return true;
} }
$Login_Error = '';
/* Authenticate user - exit if failed */ /* Authenticate user - exit if failed */
if (!session_auth()) { if (!session_auth($Login_Error)) {
display_login_form(); display_login_form($Login_Error);
exit; exit;
} }
...@@ -328,7 +330,7 @@ function display_error_form($http_code, $desc) ...@@ -328,7 +330,7 @@ function display_error_form($http_code, $desc)
} // end function } // end function
function display_login_form() function display_login_form($Login_Error = '')
{ {
global $config, $g; global $config, $g;
$g['theme'] = get_current_theme(); $g['theme'] = get_current_theme();
...@@ -400,11 +402,7 @@ function display_login_form() ...@@ -400,11 +402,7 @@ function display_login_form()
</header> </header>
<div class="login-modal-content"> <div class="login-modal-content">
<?php if (isset($_SESSION['Login_Error'])) { <div id="inputerrors" class="text-danger"><?= !empty($Login_Error) ? $Login_Error : '&nbsp;' ?></div><br />
?>
<div id="inputerrors" class="text-danger"><?=$_SESSION['Login_Error'];?></div><br />
<?php unset($_SESSION['Login_Error']);
} // endif ?>
<form class="clearfix" id="iform" name="iform" method="post" <?= $loginautocomplete ?> action="<?=$_SERVER['REQUEST_URI'];?>"> <form class="clearfix" id="iform" name="iform" method="post" <?= $loginautocomplete ?> action="<?=$_SERVER['REQUEST_URI'];?>">
...@@ -418,33 +416,27 @@ function display_login_form() ...@@ -418,33 +416,27 @@ function display_login_form()
<input id="passwordfld" type="password" name="passwordfld" class="form-control pwd" tabindex="2" /> <input id="passwordfld" type="password" name="passwordfld" class="form-control pwd" tabindex="2" />
</div> </div>
<input type="hidden" name="login" value="1" /><!-- XXX login workaround --> <button type="submit" name="login" value="1" class="btn btn-primary pull-right"><?=gettext("Login"); ?></button>
<button type="submit" name="login" class="btn btn-primary pull-right"><?=gettext("Login"); ?></button>
</form> </form>
<?php if (!$have_cookies && isset($_POST['login'])) : <?php if (!$have_cookies && isset($_POST['login'])) : ?>
?>
<br /><br /> <br /><br />
<span class="text-danger"> <span class="text-danger">
<?= gettext("Your browser must support cookies to login."); ?> <?= gettext("Your browser must support cookies to login."); ?>
</span> </span>
<?php <?php endif; ?>
endif; ?>
</div> </div>
</main> </main>
<div class="text-center">
<a target="_blank" href="<?=$g['product_website']?>" class="redlnk"><?=$g['product_name']?></a> (c) <?=$g['product_copyright_years']?>
<a href="<?=$g['product_copyright_url']?>" class="tblnk"><?=$g['product_copyright_owner']?></a>
</div> </div>
<footer class="login-foot container-fluid"> </div>
<a target="_blank" href="<?=$g['product_website']?>" class="redlnk"><?=$g['product_name']?></a> is &copy;
<?=$g['product_copyright_years']?> by <a href="<?=$g['product_copyright_url']?>" class="tblnk"><?=$g['product_copyright_owner']?></a>
</footer>
</body> </body>
</html><?php </html>
<?php } // end function
} // end function
...@@ -281,7 +281,7 @@ body{ ...@@ -281,7 +281,7 @@ body{
} }
&-content{ &-content{
padding: 40px 20px 30px 20px; padding: 20px 20px 20px 20px;
} }
&-foot{ &-foot{
......
...@@ -5594,7 +5594,7 @@ body { ...@@ -5594,7 +5594,7 @@ body {
height: 75px; height: 75px;
padding: 0 20px; } padding: 0 20px; }
.login-modal-content { .login-modal-content {
padding: 40px 20px 30px 20px; } padding: 20px 20px 20px 20px; }
.login-modal-foot { .login-modal-foot {
background: #F7F7F7; background: #F7F7F7;
border-top: 1px solid #E5E5E5; border-top: 1px solid #E5E5E5;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment