Login screen redone

merge-requests/27/head
Mike Koch 8 years ago
parent 4ff6a97a26
commit 2b0b67d2a0

@ -30,6 +30,7 @@
define('IN_SCRIPT', 1); define('IN_SCRIPT', 1);
define('HESK_PATH', '../'); define('HESK_PATH', '../');
define('PAGE_TITLE', 'LOGIN');
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); require(HESK_PATH . 'hesk_settings.inc.php');
@ -58,9 +59,6 @@ switch ($action) {
hesk_autoLogin(); hesk_autoLogin();
print_login(); print_login();
} }
/* Print footer */
require_once(HESK_PATH . 'inc/footer.inc.php');
exit(); exit();
/*** START FUNCTIONS ***/ /*** START FUNCTIONS ***/
@ -274,7 +272,7 @@ function print_login()
} }
$hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' .$hesklang['admin_login']; $hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' .$hesklang['admin_login'];
require_once(HESK_PATH . 'inc/header.inc.php'); require_once(HESK_PATH . 'inc/headerAdmin.inc.php');
if ( hesk_isREQUEST('notice') ) if ( hesk_isREQUEST('notice') )
{ {
@ -287,29 +285,34 @@ function print_login()
} }
?> ?>
<div class="loginError"><?php <div class="login-box">
/* This will handle error, success and notice messages */ <div class="login-logo">
hesk_handle_messages(); <?php echo $hesklang['staff_login_title']; ?>
?></div> </div>
<div> <div class="login-box-body">
<div class="panel panel-default form-signin"> <div class="loginError">
<div class="panel-heading"> <?php
<h4><span <?php echo $iconDisplay; ?>><span class="mega-octicon octicon-sign-in"></span>&nbsp;</span><?php echo $hesklang['admin_login']; ?></h4> /* This will handle error, success and notice messages */
hesk_handle_messages();
?>
</div> </div>
<div class="panel-body"> <form class="form-horizontal" role="form" action="index.php" method="post" name="form1">
<form class="form-signin form-horizontal" role="form" action="index.php" method="post" name="form1"> <?php
<?php if (in_array('pass',$_SESSION['a_iserror'])) { echo '<div class="form-group has-error">';} else { echo '<div class="form-group">';}?> $has_error = '';
<label for="user" class="col-sm-4 control-label"><?php echo $hesklang['username']; ?>:</label> if (in_array('pass',$_SESSION['a_iserror'])) {
$has_error = 'has-error';
}
?>
<div class="form-group <?php echo $has_error; ?>">
<label for="user" class="col-sm-4 control-label">
<?php echo $hesklang['username']; ?>
</label>
<div class="col-sm-8"> <div class="col-sm-8">
<?php <?php
if (defined('HESK_USER')) {
if (defined('HESK_USER'))
{
$savedUser = HESK_USER; $savedUser = HESK_USER;
} } else {
else $savedUser = hesk_htmlspecialchars(hesk_COOKIE('hesk_username'));
{
$savedUser = hesk_htmlspecialchars( hesk_COOKIE('hesk_username') );
} }
$is_1 = ''; $is_1 = '';
@ -318,44 +321,48 @@ function print_login()
$remember_user = hesk_POST('remember_user'); $remember_user = hesk_POST('remember_user');
if ($hesk_settings['autologin'] && (isset($_COOKIE['hesk_p']) || $remember_user == 'AUTOLOGIN') ) if ($hesk_settings['autologin'] && (isset($_COOKIE['hesk_p']) || $remember_user == 'AUTOLOGIN')) {
{ $is_1 = 'checked';
$is_1 = 'checked="checked"'; } elseif (isset($_COOKIE['hesk_username']) || $remember_user == 'JUSTUSER') {
$is_2 = 'checked';
} else {
$is_3 = 'checked';
} }
elseif (isset($_COOKIE['hesk_username']) || $remember_user == 'JUSTUSER' )
{
$is_2 = 'checked="checked"';
}
else
{
$is_3 = 'checked="checked"';
}
if ($hesk_settings['list_users'])
{
echo '<select class="form-control" name="user">';
$res = hesk_dbQuery('SELECT `user` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'users` ORDER BY `user` ASC');
while ($row=hesk_dbFetchAssoc($res))
{
$sel = (strtolower($savedUser) == strtolower($row['user'])) ? 'selected="selected"' : '';
echo '<option value="'.$row['user'].'" '.$sel.'>'.$row['user'].'</option>';
}
echo '</select>';
} if ($hesk_settings['list_users']) :
else $res = hesk_dbQuery("SELECT `user` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `active` = '1' ORDER BY `user` ASC");
{
echo '<input class="form-control" type="text" name="user" size="35" placeholder="'.htmlspecialchars($hesklang['username']).'" value="'.$savedUser.'" />';
}
?> ?>
<select class="form-control" name="user">
<?php
while ($row = hesk_dbFetchAssoc($res)):
$sel = (strtolower($savedUser) == strtolower($row['user'])) ? 'selected' : '';
?>
<option value="<?php echo $row['user']; ?>" <?php echo $sel; ?>>
<?php echo $row['user']; ?>
</option>
<?php endwhile; ?>
</select>
<?php else: ?>
<input class="form-control" type="text" name="user" size="35"
placeholder="<?php echo htmlspecialchars($hesklang['username']); ?>"
value="<?php echo $savedUser; ?>">
<?php endif; ?>
</div> </div>
</div> </div>
<?php if (in_array('pass',$_SESSION['a_iserror'])) { echo '<div class="form-group has-error">';} else { echo '<div class="form-group">';}?> <?php
<label for="pass" class="col-sm-4 control-label"><?php echo $hesklang['pass']; ?>:</label> $has_error = '';
<div class="col-sm-8"> if (in_array('pass',$_SESSION['a_iserror'])) {
<input type="password" class="form-control" id="pass" name="pass" size="35" placeholder="<?php echo htmlspecialchars($hesklang['pass']); ?>" /> $has_error = 'has-error';
}
?>
<div class="form-group <?php echo $has_error; ?>">
<label for="pass" class="col-sm-4 control-label">
<?php echo $hesklang['pass']; ?>
</label>
<div class="col-sm-8">
<input type="password" class="form-control" id="pass" name="pass" size="35" placeholder="<?php echo htmlspecialchars($hesklang['pass']); ?>">
</div>
</div> </div>
</div>
<?php <?php
if ($hesk_settings['secimg_use'] == 2) if ($hesk_settings['secimg_use'] == 2)
{ {
@ -387,22 +394,22 @@ function print_login()
} }
}; };
</script> </script>
<?php <?php
require_once(HESK_PATH . 'inc/recaptcha/recaptchalib.php'); require_once(HESK_PATH . 'inc/recaptcha/recaptchalib.php');
echo '<div class="form-group"><div class="col-md-8 col-md-offset-4">'; echo '<div class="form-group"><div class="col-md-8 col-md-offset-4">';
echo recaptcha_get_html($hesk_settings['recaptcha_public_key'], null, true); echo recaptcha_get_html($hesk_settings['recaptcha_public_key'], null, true);
echo '</div></div>'; echo '</div></div>';
} }
// Use reCaptcha API v2? // Use reCaptcha API v2?
elseif ($hesk_settings['recaptcha_use'] == 2) elseif ($hesk_settings['recaptcha_use'] == 2)
{ {
?> ?>
<div class="form-group"> <div class="form-group">
<div class="col-md-8 col-md-offset-4"> <div class="col-md-8 col-md-offset-4">
<div class="g-recaptcha" data-sitekey="<?php echo $hesk_settings['recaptcha_public_key']; ?>"></div> <div class="g-recaptcha" data-sitekey="<?php echo $hesk_settings['recaptcha_public_key']; ?>"></div>
</div> </div>
</div> </div>
<?php <?php
} }
// At least use some basic PHP generated image (better than nothing) // At least use some basic PHP generated image (better than nothing)
else else
@ -410,9 +417,9 @@ function print_login()
echo '<div class="form-group"><div class="col-md-8 col-md-offset-4">'; echo '<div class="form-group"><div class="col-md-8 col-md-offset-4">';
$cls = in_array('mysecnum',$_SESSION['a_iserror']) ? ' class="isError" ' : ''; $cls = in_array('mysecnum',$_SESSION['a_iserror']) ? ' class="isError" ' : '';
echo $hesklang['sec_enter'].'<br />&nbsp;<br /><img src="'.HESK_PATH.'print_sec_img.php?'.rand(10000,99999).'" width="150" height="40" alt="'.$hesklang['sec_img'].'" title="'.$hesklang['sec_img'].'" border="1" name="secimg" style="vertical-align:text-bottom" /> '. echo $hesklang['sec_enter'].'<br><br><img src="'.HESK_PATH.'print_sec_img.php?'.rand(10000,99999).'" width="150" height="40" alt="'.$hesklang['sec_img'].'" title="'.$hesklang['sec_img'].'" border="1" name="secimg" style="vertical-align:text-bottom"> '.
'<a href="javascript:void(0)" onclick="javascript:document.form1.secimg.src=\''.HESK_PATH.'print_sec_img.php?\'+ ( Math.floor((90000)*Math.random()) + 10000);"><img src="'.HESK_PATH.'img/reload.png" height="24" width="24" alt="'.$hesklang['reload'].'" title="'.$hesklang['reload'].'" border="0" style="vertical-align:text-bottom" /></a>'. '<a href="javascript:void(0)" onclick="javascript:document.form1.secimg.src=\''.HESK_PATH.'print_sec_img.php?\'+ ( Math.floor((90000)*Math.random()) + 10000);"><img src="'.HESK_PATH.'img/reload.png" height="24" width="24" alt="'.$hesklang['reload'].'" title="'.$hesklang['reload'].'" border="0" style="vertical-align:text-bottom"></a>'.
'<br />&nbsp;<br /><input type="text" name="mysecnum" size="20" maxlength="5" '.$cls.' />'; '<br><br><input type="text" name="mysecnum" size="20" maxlength="5" '.$cls.'>';
echo '</div></div>'; echo '</div></div>';
} }
} // End if $hesk_settings['secimg_use'] == 2 } // End if $hesk_settings['secimg_use'] == 2
@ -423,17 +430,17 @@ function print_login()
<div class="form-group"> <div class="form-group">
<div class="col-md-offset-4 col-md-8"> <div class="col-md-offset-4 col-md-8">
<div class="radio"> <div class="radio">
<label><input type="radio" name="remember_user" value="AUTOLOGIN" <?php echo $is_1; ?> /> <?php echo $hesklang['autologin']; ?></label> <label><input type="radio" name="remember_user" value="AUTOLOGIN" <?php echo $is_1; ?>> <?php echo $hesklang['autologin']; ?></label>
</div> </div>
<div class="radio"> <div class="radio">
<label><input type="radio" name="remember_user" value="JUSTUSER" <?php echo $is_2; ?> /> <?php echo $hesklang['just_user']; ?></label> <label><input type="radio" name="remember_user" value="JUSTUSER" <?php echo $is_2; ?>> <?php echo $hesklang['just_user']; ?></label>
</div> </div>
<div class="radio"> <div class="radio">
<label><input type="radio" name="remember_user" value="NOTHANKS" <?php echo $is_3; ?> /> <?php echo $hesklang['nothx']; ?></label> <label><input type="radio" name="remember_user" value="NOTHANKS" <?php echo $is_3; ?>> <?php echo $hesklang['nothx']; ?></label>
</div> </div>
</div> </div>
</div> </div>
<?php <?php
} }
else else
{ {
@ -445,40 +452,33 @@ function print_login()
</div> </div>
</div> </div>
</div> </div>
<?php <?php
} // End if $hesk_settings['autologin'] } // End if $hesk_settings['autologin']
?> ?>
<div class="form-group"> <div class="form-group">
<div class="col-md-offset-4 col-md-8"> <div class="col-md-offset-4 col-md-8">
<input type="submit" value="<?php echo $hesklang['click_login']; ?>" class="btn btn-default" /> <input type="submit" value="<?php echo $hesklang['click_login']; ?>" class="btn btn-default">
<input type="hidden" name="a" value="do_login" /> <input type="hidden" name="a" value="do_login">
<?php <?php
if ( hesk_isREQUEST('goto') && $url=hesk_REQUEST('goto') ) if ( hesk_isREQUEST('goto') && $url=hesk_REQUEST('goto') )
{ {
echo '<input type="hidden" name="goto" value="'.$url.'" />'; echo '<input type="hidden" name="goto" value="'.$url.'">';
} }
// Do we allow staff password reset? // Do we allow staff password reset?
if ($hesk_settings['reset_pass']) if ($hesk_settings['reset_pass'])
{ {
echo '<br />&nbsp;<br /><a href="password.php" class="smaller">'.$hesklang['fpass'].'</a>'; echo '<br><br><a href="password.php" class="smaller">'.$hesklang['fpass'].'</a>';
} }
?> ?>
</div> </div>
</div> </div>
</form>
</form>
</div>
</div> </div>
</div>
</div> <?php
<p>&nbsp;</p>
<?php
hesk_cleanSessionVars('a_iserror'); hesk_cleanSessionVars('a_iserror');
require_once(HESK_PATH . 'inc/footer.inc.php');
exit(); exit();
} // End print_login() } // End print_login()

@ -131,4 +131,23 @@
button.dropdown-submit { button.dropdown-submit {
background: none !important; background: none !important;
border: none; border: none;
}
.form-signin {
max-width: 800px;
margin: 0 auto;
}
.loginError {
padding-top: 20px;
margin-left: auto;
margin-right: auto;
}
.login-box {
width: 500px;
}
.login-box-body {
border-radius: 5px;
} }

@ -140,6 +140,12 @@ $modsForHesk_settings = mfh_getSettings();
.h3questionmark { .h3questionmark {
color: <?php echo $modsForHesk_settings['questionMarkColor']; ?>; color: <?php echo $modsForHesk_settings['questionMarkColor']; ?>;
} }
<?php if (defined('PAGE_TITLE') && PAGE_TITLE == 'LOGIN'): ?>
body {
background: #d2d6de;
}
<?php endif; ?>
</style> </style>
<?php <?php

@ -65,6 +65,7 @@ $hesklang['revoke_all_tokens'] = 'Revoke All Tokens';
$hesklang['generated_token_colon'] = 'Generated Token:'; $hesklang['generated_token_colon'] = 'Generated Token:';
$hesklang['record_this_token_warning'] = 'Please record this token, as this is the only time you will be able to view it!'; $hesklang['record_this_token_warning'] = 'Please record this token, as this is the only time you will be able to view it!';
$hesklang['all_tokens_revoked'] = 'All tokens for this user have been revoked'; $hesklang['all_tokens_revoked'] = 'All tokens for this user have been revoked';
$hesklang['staff_login_title'] = 'Staff Login';
// ADDED OR MODIFIED IN Mods for HESK 2.6.0 // ADDED OR MODIFIED IN Mods for HESK 2.6.0
$hesklang['search_logs'] = 'Search Logs'; $hesklang['search_logs'] = 'Search Logs';

Loading…
Cancel
Save