Commit b79c5bac authored by Till Brehm's avatar Till Brehm
Browse files

New ISPConfig login.

parent 831dd0a0
......@@ -36,8 +36,8 @@ $module = $_REQUEST["s_mod"];
$page = $_REQUEST["s_pg"];
*/
$module = 'login';
$page = 'index';
$module = 'dashboard';
$page = 'dashboard';
if(!preg_match("/^[a-z]{2,20}$/i", $module)) die('module name contains unallowed chars.');
if(!preg_match("/^[a-z]{2,20}$/i", $page)) die('page name contains unallowed chars.');
......
......@@ -31,7 +31,13 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
require_once '../lib/config.inc.php';
require_once '../lib/app.inc.php';
if(!isset($_SESSION['s']['module']['name'])) $_SESSION['s']['module']['name'] = 'login';
// Check if we have an active users ession and redirect to login if thats not the case.
if($_SESSION['s']['user']['active'] != 1) {
header('Location: /login/');
die();
}
if(!isset($_SESSION['s']['module']['name'])) $_SESSION['s']['module']['name'] = 'dashboard';
$app->uses('tpl');
$app->tpl->newTemplate('main.tpl.htm');
......
This diff is collapsed.
......@@ -10,7 +10,7 @@ $wb['pw_error_noinput'] = 'Please enter email address and username.';
$wb['pw_reset_mail_msg'] = 'The password to your ISPConfig 3 control panel account has been reset. The new password is: ';
$wb['pw_reset_mail_title'] = 'ISPConfig 3 Control panel password has been reset.';
$wb['user_regex_error'] = 'Username contains unallowed characters or is longer then 64 characters.';
$wb['pw_error_length'] = 'The password length is > 64 characters.';
$wb['pw_error_length'] = 'The password length is < 1 or > 64 characters.';
$wb['username_txt'] = 'Username';
$wb['password_txt'] = 'Password';
$wb['login_button_txt'] = 'Login';
......
......@@ -6,7 +6,7 @@ $wb['pw_error_noinput'] = 'Моля въведете потребителско
$wb['pw_reset_mail_msg'] = 'Новата парола за вашия ISPConfig 3 контролен панел е:';
$wb['pw_reset_mail_title'] = 'Нова парола за вашия ISPConfig 3 контролен панел';
$wb['user_regex_error'] = 'Потребителско име contains unallowed characters or is longer then 64 characters.';
$wb['pw_error_length'] = 'The password length is > 64 characters.';
$wb['pw_error_length'] = 'The password length is < 1 or > 64 characters.';
$wb['error_user_password_empty'] = 'Потребителско име or Password empty.';
$wb['error_user_password_incorrect'] = 'Потребителско име or Password wrong.';
$wb['error_user_blocked'] = 'User is blocked.';
......
......@@ -9,7 +9,7 @@ $wb['pw_error'] = 'Nome de usuário ou correio eletrônico não coincidem.';
$wb['pw_error_noinput'] = 'Favor informar nome de usuário e endereço de correio válidos.';
$wb['pw_reset_mail_msg'] = 'Sua senha do painel de controle foi restabelecida. A sua nova senha é: ';
$wb['pw_reset_mail_title'] = 'Sua senha do painel de controle foi restabelecida.';
$wb['user_regex_error'] = 'O nome de usuário contém mais de 64 caracteres ou contém caracteres inválidos.';
$wb['user_regex_error'] = 'O nome de usuário contém < 1 or mais de 64 caracteres ou contém caracteres inválidos.';
$wb['pw_error_length'] = 'Tamanho da senha não pode ser maior do que 64 caracteres.';
$wb['username_txt'] = 'Usuário';
$wb['password_txt'] = 'Senha';
......
......@@ -10,7 +10,7 @@ $wb['pw_error_noinput'] = 'Bitte geben Sie Ihre E-Mail Adresse und Ihren Benutze
$wb['pw_reset_mail_msg'] = 'Das Passwort wurde zurückgesetzt. Das neue Passwort lautet: ';
$wb['pw_reset_mail_title'] = 'Ihr Passwort wurde zurückgesetzt.';
$wb['user_regex_error'] = 'Benutzername beinhaltet nicht erlaubte Zeichen oder ist länger als 64 Zeichen.';
$wb['pw_error_length'] = 'Die Passwortlänge ist > 64 Zeichen.';
$wb['pw_error_length'] = 'Die Passwortlänge ist < 1 oder > 64 Zeichen.';
$wb['login_txt'] = 'Anmelden';
$wb['username_txt'] = 'Benutzername';
$wb['password_txt'] = 'Passwort';
......
......@@ -10,7 +10,7 @@ $wb['pw_error_noinput'] = 'Please enter email address and username.';
$wb['pw_reset_mail_msg'] = 'The password to your ISPConfig 3 control panel account has been reset. The new password is: ';
$wb['pw_reset_mail_title'] = 'ISPConfig 3 Control panel password has been reset.';
$wb['user_regex_error'] = 'Username contains unallowed characters or is longer than 64 characters.';
$wb['pw_error_length'] = 'The password length is > 64 characters.';
$wb['pw_error_length'] = 'The password length is < 1 or > 64 characters.';
$wb['email_error'] = 'Email contains unallowed characters or has a invalid format.';
$wb['login_txt'] = "Login";
$wb['username_txt'] = "Username";
......
......@@ -92,12 +92,13 @@ echo '
'.$wb['login_2_txt'].'<br />
<div style="visibility:hidden">
<input type="text" name="username" value="' . $dbData['username'] . '" />
<input type="password" name="passwort" value="' . $dbData['passwort'] .'" />
<input type="password" name="password" value="' . $dbData['passwort'] .'" />
</div>
<input type="hidden" name="s_mod" value="login" />
<input type="hidden" name="s_pg" value="index" />
<input type="hidden" name="s_mod" value="dashboard" />
<input type="hidden" name="s_pg" value="dashboard" />
<input type="hidden" name="login_as" value="1" />
<div class="wf_actions buttons">
<button class="positive iconstxt icoPositive" type="button" value="'.$wb['btn_yes_txt'].'" onclick="submitLoginForm(' . "'pageForm'" . ');"><span>'.$wb['btn_yes_txt'].'</span></button>
<button class="positive iconstxt icoPositive" type="button" value="'.$wb['btn_yes_txt'].'" data-submit-form="pageForm" data-form-action="/login/index.php"><span>'.$wb['btn_yes_txt'].'</span></button>
<button class="negative iconstxt icoNegative" type="button" value="'.$wb['btn_back_txt'].'" data-load-content="'.$backlink.'"><span>'.$wb['btn_back_txt'].'</span></button>
</div>
';
......
......@@ -50,12 +50,13 @@ if ((isset($_SESSION['s_old']) && ($_SESSION['s_old']['user']['typ'] == 'admin'
'.str_replace('{UTYPE}', $utype, $wb['login_as_or_logout_txt']).'<br />
<div style="visibility:hidden">
<input type="text" name="username" value="' . $_SESSION['s_old']['user']['username'] . '" />
<input type="password" name="passwort" value="' . $_SESSION['s_old']['user']['passwort'] .'" />
<input type="password" name="password" value="' . $_SESSION['s_old']['user']['passwort'] .'" />
</div>
<input type="hidden" name="s_mod" value="login" />
<input type="hidden" name="s_pg" value="index" />
<input type="hidden" name="login_as" value="1" />
<div class="wf_actions buttons">
<button class="positive iconstxt icoPositive" type="button" value="Yes, re-login as ' . $utype . '" onclick="submitLoginForm(' . "'pageForm'" . ');"><span>Yes, re-login as ' . $utype . '</span></button>
<button class="positive iconstxt icoPositive" type="button" value="Yes, re-login as ' . $utype . '" data-submit-form="pageForm" data-form-action="/login/index.php"><span>Yes, re-login as ' . $utype . '</span></button>
<button class="negative iconstxt icoNegative" type="button" value="No, logout" data-load-content="login/logout.php?l=1"><span>No, logout</span></button>
</div>
';
......
<?php
/*
Copyright (c) 2008, Till Brehm, projektfarm Gmbh
Copyright (c) 2008 - 2015, Till Brehm, ISPConfig UG
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
......@@ -38,18 +38,25 @@ if($security_config['password_reset_allowed'] != 'yes') die('Password reset func
// Loading the template
$app->uses('tpl');
$app->tpl->newTemplate("form.tpl.htm");
$app->tpl->newTemplate('main_login.tpl.htm');
$app->tpl->setInclude('content_tpl', 'templates/password_reset.htm');
$app->tpl_defaults();
include ISPC_ROOT_PATH.'/web/login/lib/lang/'.$_SESSION['s']['language'].'.lng';
$app->tpl->setVar($wb);
$continue = true;
if(isset($_POST['username']) && $_POST['username'] != '' && $_POST['email'] != '' && $_POST['username'] != 'admin') {
if(!preg_match("/^[\w\.\-\_]{1,64}$/", $_POST['username'])) die($app->lng('user_regex_error'));
if(!preg_match("/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z]{2,10}$/i", $_POST['email'])) die($app->lng('email_error'));
if(!preg_match("/^[\w\.\-\_]{1,64}$/", $_POST['username'])) {
$app->tpl->setVar("error", $wb['user_regex_error']);
$continue = false;
}
if(!preg_match("/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z]{2,10}$/i", $_POST['email'])) {
$app->tpl->setVar("error", $wb['email_error']);
$continue = false;
}
$username = $_POST['username'];
$email = $_POST['email'];
......@@ -58,7 +65,7 @@ if(isset($_POST['username']) && $_POST['username'] != '' && $_POST['email'] != '
if($client['lost_password_function'] == 0) {
$app->tpl->setVar("error", $wb['lost_password_function_disabled_txt']);
} else {
} elseif ($continue) {
if($client['client_id'] > 0) {
$server_config_array = $app->getconf->get_global_config();
$min_password_length = 8;
......@@ -91,9 +98,26 @@ if(isset($_POST['username']) && $_POST['username'] != '' && $_POST['email'] != '
}
}
} else {
$app->tpl->setVar("msg", $wb['pw_error_noinput']);
if(isset($_POST) && count($_POST) > 0) $app->tpl->setVar("msg", $wb['pw_error_noinput']);
}
$app->tpl->setVar('current_theme', isset($_SESSION['s']['theme']) ? $_SESSION['s']['theme'] : 'default');
// Logo
$logo = $app->db->queryOneRecord("SELECT * FROM sys_ini WHERE sysini_id = 1");
if($logo['custom_logo'] != ''){
$base64_logo_txt = $logo['custom_logo'];
} else {
$base64_logo_txt = $logo['default_logo'];
}
$tmp_base64 = explode(',', $base64_logo_txt, 2);
$logo_dimensions = $app->functions->getimagesizefromstring(base64_decode($tmp_base64[1]));
$app->tpl->setVar('base64_logo_width', $logo_dimensions[0].'px');
$app->tpl->setVar('base64_logo_height', $logo_dimensions[1].'px');
$app->tpl->setVar('base64_logo_txt', $base64_logo_txt);
// Title
$app->tpl->setVar('company_name', $sys_config['company_name']. ' :: ');
$app->tpl_defaults();
$app->tpl->pparse();
......
<div class='page-header'>
<h1><tmpl_var name="login_txt"></h1>
</div>
<p><tmpl_var name="list_desc_txt"></p>
<div class="panel panel_login">
<tmpl_if name="msg">
<div id="OKMsg"><p><tmpl_var name="msg"></p></div>
</tmpl_if>
<tmpl_if name="error">
<div id="errorMsg"><h3>{tmpl_var name='error_txt'}</h3><ol><li><tmpl_var name="error"></li></ol><br /><a href="#" data-load-content="login/password_reset.php">{tmpl_var name='pw_lost_txt'}</a></div>
</tmpl_if>
<div class="pnl_formsarea">
<div class="form-group">
<label for="username" class="col-sm-3 control-label">{tmpl_var name='username_txt'}</label>
<div class="col-sm-9"><input type="text" name="username" id="username" value="" class="form-control" onkeypress="if (event.keyCode && event.keyCode == 13) {ISPConfig.submitLoginForm('pageForm'); return false;};" /></div></div>
<div class="form-group">
<label for="passwort" class="col-sm-3 control-label">{tmpl_var name='password_txt'}</label>
<div class="col-sm-9"><input type="password" name="passwort" id="passwort" value="" class="form-control" onkeypress="if (event.keyCode && event.keyCode == 13) {ISPConfig.submitLoginForm('pageForm'); return false;};" /></div></div>
<tmpl_if name="session_timeout" op=">" value="0">
<tmpl_if name="session_allow_endless" value="y">
<div class="form-group">
<label for="passwort" class="col-sm-3 control-label">{tmpl_var name='stay_logged_in_txt'}</label>
<div class="col-sm-9"><input class="form-control" type="checkbox" name="stay" id="stay" value="1" onkeypress="if (event.keyCode && event.keyCode == 13) {ISPConfig.submitLoginForm('pageForm'); return false;};" /></div></div>
</tmpl_if>
</tmpl_if>
<input type="hidden" name="s_mod" value="login" />
<input type="hidden" name="s_pg" value="index" />
<div class="clear"><div class="right">
<button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='add_new_record_txt'}" onclick="ISPConfig.submitLoginForm('pageForm');">{tmpl_var name='login_button_txt'}</button>
<tmpl_if name="pw_lost_show"><button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='pw_lost_txt'}" data-load-content="login/password_reset.php">{tmpl_var name='pw_lost_txt'}</button></tmpl_if>
</div></div>
</div>
</div>
<script language="JavaScript" type="text/javascript">
$('#username').closest('form').attr('autocomplete','on');
</script>
\ No newline at end of file
<tmpl_if name="error">
<div class="alert alert-danger" role="alert"><tmpl_var name="error"></div>
</tmpl_if>
<form accept-charset="UTF-8" role="form" method="post" action="index.php">
<fieldset>
<div class="form-group">
<input class="form-control" placeholder="{tmpl_var name='username_txt'}" name="username" id="username" type="text">
</div>
<div class="form-group">
<input class="form-control" placeholder="{tmpl_var name='password_txt'}" name="password" id="password" type="password" value="">
</div>
<tmpl_if name="session_timeout" op=">" value="0">
<tmpl_if name="session_allow_endless" value="y">
<div class="checkbox">
<label>
<input name="stay" id="stay" type="checkbox" value="1"> {tmpl_var name='stay_logged_in_txt'}
</label>
</div>
</tmpl_if>
</tmpl_if>
<input type="hidden" name="s_mod" value="login" />
<input type="hidden" name="s_pg" value="index" />
<div class="right">
<input class="btn btn-default formbutton-default" type="submit" value="{tmpl_var name='login_txt'}">
<tmpl_if name="pw_lost_show"><button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='pw_lost_txt'}" onClick="document.location.href='password_reset.php';">{tmpl_var name='pw_lost_txt'}</button></tmpl_if>
</div>
</fieldset>
</form>
\ No newline at end of file
<div class='page-header'>
<h1><tmpl_var name="pw_reset_txt"></h1>
</div>
<tmpl_if name="msg">
<div class="alert alert-success" role="alert"><tmpl_var name="msg"></div>
</tmpl_if>
<tmpl_if name="error">
<div class="alert alert-danger" role="alert"><tmpl_var name="error"></div>
</tmpl_if>
<h2><tmpl_var name="pw_reset_txt"></h2>
<p><tmpl_var name="list_desc_txt"></p>
<div class="panel panel_password_reset">
<tmpl_if name="msg">
<div id="OKMsg"><p><tmpl_var name="msg"></p></div>
</tmpl_if>
<tmpl_if name="error">
<div id="errorMsg"><h3><tmpl_var name="error_txt"></h3><ol><tmpl_var name="error"></ol></div>
</tmpl_if>
<div class="pnl_formsarea">
<legend>{tmpl_var name='pw_reset_txt'}</legend>
<div class="form-group">
<label for="email" class="col-sm-3 control-label"><em>*</em> {tmpl_var name='email_txt'}</label>
<div class="col-sm-9"><input type="text" name="email" id="email" value="" class="form-control" /></div></div>
<div class="form-group">
<label for="username" class="col-sm-3 control-label"><em>*</em> {tmpl_var name='username_txt'}</label>
<div class="col-sm-9"><input type="text" name="username" id="username" value="" class="form-control" /></div></div>
<input type="hidden" name="s_mod" value="login" />
<input type="hidden" name="s_pg" value="index" />
<div class="clear"><div class="right">
<button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='pw_button_txt'}" data-submit-form="pageForm" data-form-action="login/password_reset.php">{tmpl_var name='pw_button_txt'}</button>
<button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='back_txt'}" onclick="ISPConfig.loadInitContent();">{tmpl_var name='back_txt'}</button>
</div></div>
</div>
</div>
\ No newline at end of file
<form accept-charset="UTF-8" role="form" method="post" action="password_reset.php">
<fieldset>
<div class="form-group">
<input class="form-control" placeholder="{tmpl_var name='email_txt'}" name="email" id="email" type="text">
</div>
<div class="form-group">
<input class="form-control" placeholder="{tmpl_var name='username_txt'}" name="username" id="username" type="text">
</div>
<input type="hidden" name="s_mod" value="login" />
<input type="hidden" name="s_pg" value="index" />
<div class="right">
<input class="btn btn-default formbutton-default" type="submit" value="{tmpl_var name='pw_button_txt'}">
<button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='pw_lost_txt'}" onClick="document.location.href='index.php';">{tmpl_var name='back_txt'}</button>
</div>
</fieldset>
</form>
\ No newline at end of file
......@@ -83,12 +83,16 @@ if(isset($_GET['nav']) && $_GET['nav'] == 'top') {
}
} else {
//* Loading Login Module
/*
include_once 'login/lib/module.conf.php';
$_SESSION['s']['module'] = $module;
$topnav[] = array( 'title' => 'Login',
'active' => 1);
$module = null;
unset($module);
*/
header('Location: /login/');
die();
}
//* Topnavigation
......
......@@ -11,7 +11,7 @@ var ISPConfig = {
options: {
useLoadIndicator: false,
useComboBox: false,
useComboBox: false
},
setOption: function(key, value) {
......@@ -91,7 +91,7 @@ var ISPConfig = {
placeholder: '',
width: 'element',
selectOnBlur: true,
allowClear: true,
allowClear: true
});
}
},
......@@ -143,7 +143,7 @@ var ISPConfig = {
},
/* THIS ONE SHOULD BE REMOVED AFTER CREATING THE STATIC LOGIN PAGE!!! */
submitLoginForm: function(formname) {
/*submitLoginForm: function(formname) {
//* Validate form. TODO: username and password with strip();
var frm = document.getElementById(formname);
var userNameObj = frm.username;
......@@ -189,7 +189,7 @@ var ISPConfig = {
ISPConfig.reportError('Ajax Request was not successful.110');
}
});
},
},*/
submitForm: function(formname, target, confirmation) {
var successMessage = arguments[3];
......@@ -209,6 +209,9 @@ var ISPConfig = {
if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) {
var parts = jqXHR.responseText.split(':');
ISPConfig.loadContent(parts[1]);
} else if (jqXHR.responseText.indexOf('LOGIN_REDIRECT:') > -1) {
// Go to the login page
document.location.href = '/index.php';
} else {
$('#pageContent').html(jqXHR.responseText);
ISPConfig.onAfterContentLoad(target, $('#'+formname).serialize());
......@@ -354,8 +357,8 @@ var ISPConfig = {
loadInitContent: function() {
var pageContentObject = $.ajax({
type: "GET",
url: "content.php",
data: "s_mod=login&s_pg=index",
url: "dashboard/dashboard.php",
data: "",
dataType: "html",
beforeSend: function() {
ISPConfig.showLoadIndicator();
......@@ -366,7 +369,7 @@ var ISPConfig = {
ISPConfig.loadContent(parts[1]);
} else {
$('#pageContent').html(jqXHR.responseText);
ISPConfig.onAfterContentLoad('content.php', "s_mod=login&s_pg=index");
ISPConfig.onAfterContentLoad('dashboard/dashboard.php', "");
ISPConfig.pageFormChanged = false;
}
ISPConfig.hideLoadIndicator();
......
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8' />
<title><tmpl_var name="company_name"><tmpl_var name="app_title"></title>
<meta name='viewport' content='width=device-width, user-scalable=yes'>
<meta name='description' lang='en' content='' />
<meta name='keywords' lang='en' content='' />
<meta name='robots' content='index, follow' />
<link rel='stylesheet' href='../themes/<tmpl_var name='current_theme'>/assets/stylesheets/bootstrap.min.css' />
<link rel='stylesheet' href='../themes/<tmpl_var name='current_theme'>/assets/stylesheets/fonts.min.css' />
<link rel='stylesheet' href='../themes/<tmpl_var name='current_theme'>/assets/stylesheets/ispconfig.min.css' />
<link rel='stylesheet' href='../themes/<tmpl_var name='current_theme'>/assets/stylesheets/pushy.min.css' />
<link rel='stylesheet' href='../themes/<tmpl_var name='current_theme'>/assets/stylesheets/bootstrap-datetimepicker.min.css' />
<link rel='stylesheet' href='../themes/<tmpl_var name='current_theme'>/assets/stylesheets/responsive.min.css' />
<link rel='stylesheet' href='../themes/<tmpl_var name='current_theme'>/assets/stylesheets/themes/default/theme.min.css' />
<link rel='stylesheet' href='../themes/<tmpl_var name='current_theme'>/assets/stylesheets/select2.css' />
<link rel='stylesheet' href='../themes/<tmpl_var name='current_theme'>/assets/stylesheets/select2-bootstrap.css' />
<link rel='stylesheet' href='../themes/<tmpl_var name='current_theme'>/assets/stylesheets/login.css' />
</head>
<body>
<div class="container" style="min-height: 100%; min-height: 100vh; display: flex;">
<div class="row" style="margin: auto; width:100%;">
<div class="col-md-4 col-md-offset-4">
<div class="panel panel-default">
<div class="panel-heading" style="background: linear-gradient(to bottom, white, #eef0f2);">
<img src="{tmpl_var name='base64_logo_txt'}">
</div>
<div class="panel-body">
<tmpl_dyninclude name="content_tpl">
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/bootstrap.min.js'></script>
<script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/bootstrap-datetimepicker.min.js'></script>
<script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/ispconfig.min.js'></script>
<script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/modernizr.custom.min.js'></script>
<script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/pushy.min.js'></script>
<script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/responsive.min.js'></script>
<script src='../js/select2/select2.min.js'></script>
<script src='../js/scrigo.js.php'></script>
<script type="text/javascript" src="../js/jquery.ispconfigsearch.js"></script>
<script type="text/javascript" src="../js/jquery.tipsy.js"></script>
<tmpl_loop name="js_d_includes">
<script type="text/javascript" src="../js/js.d/<tmpl_var name='file'>"></script>
</tmpl_loop>
</body>
</html>
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