responsive config login
This commit is contained in:
parent
97dc46fb7d
commit
78c4043927
|
@ -1511,6 +1511,73 @@ function enforceUserIsLoggedIn($check2ndFactor = true) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints the content of the header part.
|
||||||
|
*
|
||||||
|
* @param string $title page title
|
||||||
|
* @param string $prefix prefix to LAM main folder (e.g. "..")
|
||||||
|
*/
|
||||||
|
function printHeaderContents($title, $prefix) {
|
||||||
|
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">';
|
||||||
|
echo '<title>';
|
||||||
|
echo $title;
|
||||||
|
echo '</title>';
|
||||||
|
// include all CSS files
|
||||||
|
$cssDirName = dirname(__FILE__) . '/../style';
|
||||||
|
$cssDir = dir($cssDirName);
|
||||||
|
$cssFiles = array();
|
||||||
|
$cssEntry = $cssDir->read();
|
||||||
|
while ($cssEntry !== false) {
|
||||||
|
if (substr($cssEntry, strlen($cssEntry) - 4, 4) == '.css') {
|
||||||
|
$cssFiles[] = $cssEntry;
|
||||||
|
}
|
||||||
|
$cssEntry = $cssDir->read();
|
||||||
|
}
|
||||||
|
sort($cssFiles);
|
||||||
|
foreach ($cssFiles as $cssEntry) {
|
||||||
|
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$prefix/style/$cssEntry\">";
|
||||||
|
}
|
||||||
|
// include responsive CSS
|
||||||
|
$cssDirName = dirname(__FILE__) . '/../style/responsive';
|
||||||
|
$cssDir = dir($cssDirName);
|
||||||
|
$cssFiles = array();
|
||||||
|
$cssEntry = $cssDir->read();
|
||||||
|
while ($cssEntry !== false) {
|
||||||
|
if (substr($cssEntry, strlen($cssEntry) - 4, 4) == '.css') {
|
||||||
|
$cssFiles[] = $cssEntry;
|
||||||
|
}
|
||||||
|
$cssEntry = $cssDir->read();
|
||||||
|
}
|
||||||
|
sort($cssFiles);
|
||||||
|
foreach ($cssFiles as $cssEntry) {
|
||||||
|
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$prefix/style/responsive/$cssEntry\">";
|
||||||
|
}
|
||||||
|
echo '<link rel="shortcut icon" type="image/x-icon" href="' . $prefix . '/graphics/favicon.ico">';
|
||||||
|
echo '<link rel="icon" href="' . $prefix . '/graphics/logo136.png">';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints script tags for all LAM JS files.
|
||||||
|
*
|
||||||
|
* @param string $prefix prefix to LAM main folder (e.g. "..")
|
||||||
|
*/
|
||||||
|
function printJsIncludes($prefix) {
|
||||||
|
$jsDirName = dirname(__FILE__) . '/../templates/lib';
|
||||||
|
$jsDir = dir($jsDirName);
|
||||||
|
$jsFiles = array();
|
||||||
|
$jsEntry = $jsDir->read();
|
||||||
|
while ($jsEntry !== false) {
|
||||||
|
if (substr($jsEntry, strlen($jsEntry) - 3, 3) == '.js') {
|
||||||
|
$jsFiles[] = $jsEntry;
|
||||||
|
}
|
||||||
|
$jsEntry = $jsDir->read();
|
||||||
|
}
|
||||||
|
sort($jsFiles);
|
||||||
|
foreach ($jsFiles as $jsEntry) {
|
||||||
|
echo "<script type=\"text/javascript\" src=\"$prefix/templates/lib/" . $jsEntry . "\"></script>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class LAMException extends Exception {
|
class LAMException extends Exception {
|
||||||
|
|
||||||
private $title;
|
private $title;
|
||||||
|
|
|
@ -338,7 +338,7 @@ function isAccountTypeHidden($type) {
|
||||||
/**
|
/**
|
||||||
* Returns a list of all supported languages.
|
* Returns a list of all supported languages.
|
||||||
*
|
*
|
||||||
* @return array languages
|
* @return LAMLanguage[] languages
|
||||||
*/
|
*/
|
||||||
function getLanguages() {
|
function getLanguages() {
|
||||||
$languages = array();
|
$languages = array();
|
||||||
|
|
|
@ -231,6 +231,10 @@ table.collapse {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
.bold {
|
.bold {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
@ -403,7 +407,7 @@ td.loginRightBox {
|
||||||
box-shadow: 2px 2px 5px #a0a0a4;
|
box-shadow: 2px 2px 5px #a0a0a4;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
padding: 20px;
|
padding: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.limitWidth {
|
.limitWidth {
|
||||||
|
|
|
@ -1,4 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
namespace LAM\CONFIG;
|
||||||
|
use \htmlStatusMessage;
|
||||||
|
use \htmlResponsiveRow;
|
||||||
|
use \LAMCfgMain;
|
||||||
|
use \htmlButton;
|
||||||
|
use \htmlOutputText;
|
||||||
|
use \htmlLink;
|
||||||
|
use \htmlDiv;
|
||||||
|
use \htmlResponsiveSelect;
|
||||||
|
use \htmlResponsiveInputField;
|
||||||
|
use \htmlHorizontalLine;
|
||||||
/*
|
/*
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
|
@ -46,7 +57,9 @@ session_regenerate_id(true);
|
||||||
setlanguage();
|
setlanguage();
|
||||||
|
|
||||||
// get error message from confmain.php
|
// get error message from confmain.php
|
||||||
if (isset($_SESSION['conf_message'])) $message = $_SESSION['conf_message'];
|
if (isset($_SESSION['conf_message'])) {
|
||||||
|
$message = $_SESSION['conf_message'];
|
||||||
|
}
|
||||||
|
|
||||||
// remove settings from session
|
// remove settings from session
|
||||||
$sessionKeys = array_keys($_SESSION);
|
$sessionKeys = array_keys($_SESSION);
|
||||||
|
@ -57,47 +70,17 @@ for ($i = 0; $i < sizeof($sessionKeys); $i++) {
|
||||||
echo $_SESSION['header'];
|
echo $_SESSION['header'];
|
||||||
|
|
||||||
$files = getConfigProfiles();
|
$files = getConfigProfiles();
|
||||||
?>
|
printHeaderContents(_("Login"), '../..');
|
||||||
|
|
||||||
<title>
|
if (sizeof($files) < 1) {
|
||||||
<?php
|
$message = new htmlStatusMessage('INFO', _("No server profiles found. Please create one."));
|
||||||
echo _("Login");
|
}
|
||||||
|
$tabindex = 1;
|
||||||
?>
|
?>
|
||||||
</title>
|
|
||||||
<?php
|
|
||||||
// include all CSS files
|
|
||||||
$cssDirName = dirname(__FILE__) . '/../../style';
|
|
||||||
$cssDir = dir($cssDirName);
|
|
||||||
$cssFiles = array();
|
|
||||||
$cssEntry = $cssDir->read();
|
|
||||||
while ($cssEntry !== false) {
|
|
||||||
if (substr($cssEntry, strlen($cssEntry) - 4, 4) == '.css') {
|
|
||||||
$cssFiles[] = $cssEntry;
|
|
||||||
}
|
|
||||||
$cssEntry = $cssDir->read();
|
|
||||||
}
|
|
||||||
sort($cssFiles);
|
|
||||||
foreach ($cssFiles as $cssEntry) {
|
|
||||||
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/" . $cssEntry . "\">\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="../../graphics/favicon.ico">
|
|
||||||
<link rel="icon" href="../../graphics/logo136.png">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="admin">
|
||||||
<?php
|
<?php
|
||||||
// include all JavaScript files
|
printJsIncludes('../..');
|
||||||
$jsDirName = dirname(__FILE__) . '/../lib';
|
|
||||||
$jsDir = dir($jsDirName);
|
|
||||||
$jsFiles = array();
|
|
||||||
while ($jsEntry = $jsDir->read()) {
|
|
||||||
if (substr($jsEntry, strlen($jsEntry) - 3, 3) != '.js') continue;
|
|
||||||
$jsFiles[] = $jsEntry;
|
|
||||||
}
|
|
||||||
sort($jsFiles);
|
|
||||||
foreach ($jsFiles as $jsEntry) {
|
|
||||||
echo "<script type=\"text/javascript\" src=\"../lib/" . $jsEntry . "\"></script>\n";
|
|
||||||
}
|
|
||||||
// set focus on password field
|
// set focus on password field
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" language="javascript">
|
<script type="text/javascript" language="javascript">
|
||||||
|
@ -121,49 +104,24 @@ $files = getConfigProfiles();
|
||||||
<br><br>
|
<br><br>
|
||||||
<!-- form to change existing profiles -->
|
<!-- form to change existing profiles -->
|
||||||
<form action="confmain.php" method="post" autocomplete="off">
|
<form action="confmain.php" method="post" autocomplete="off">
|
||||||
<table align="center"><tr><td>
|
|
||||||
<table align="center" border="0" rules="none" bgcolor="white" class="ui-corner-all roundedShadowBox">
|
|
||||||
<tr>
|
|
||||||
<td style="border-style:none" rowspan="3" width="20"></td>
|
|
||||||
<td style="border-style:none" height="20"></td>
|
|
||||||
<td style="border-style:none" rowspan="3" width="20"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="border-style:none" align="center">
|
|
||||||
<b>
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
$row = new htmlResponsiveRow();
|
||||||
|
|
||||||
|
// message
|
||||||
|
if ($message !== null) {
|
||||||
|
$row->add($message, 12);
|
||||||
|
$row->addVerticalSpacer('2rem');
|
||||||
|
}
|
||||||
|
|
||||||
|
$box = new htmlResponsiveRow();
|
||||||
if (sizeof($files) > 0) {
|
if (sizeof($files) > 0) {
|
||||||
echo _("Please enter your password to change the server preferences:");
|
$box->add(new htmlOutputText(_("Please enter your password to change the server preferences:")), 12);
|
||||||
}
|
$box->addVerticalSpacer('1.5rem');
|
||||||
?>
|
|
||||||
</b>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr><td style="border-style:none" > </td></tr>
|
|
||||||
<?php
|
|
||||||
if (sizeof($files) < 1) $message = _("No server profiles found. Please create one.");
|
|
||||||
// print message if login was incorrect or no config profiles are present
|
|
||||||
if (isset($message)) { // $message is set by confmain.php (requires conflogin.php then)
|
|
||||||
echo "<tr>\n";
|
|
||||||
echo "<td style=\"border-style:none\" rowspan=\"2\"></td>\n";
|
|
||||||
echo "<td style=\"border-style:none\" align=\"center\"><b><font color=red>" . $message . "</font></b></td>\n";
|
|
||||||
echo "<td style=\"border-style:none\" rowspan=\"2\"></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
echo "<tr>\n";
|
|
||||||
echo "<td style=\"border-style:none\" > </td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td style="border-style:none" rowspan="4" width="20"></td>
|
|
||||||
<td style="border-style:none" align="center">
|
|
||||||
<?php
|
|
||||||
$conf = new LAMCfgMain();
|
$conf = new LAMCfgMain();
|
||||||
$group = new htmlTable();
|
|
||||||
$profiles = array();
|
|
||||||
$selectedProfile = array();
|
$selectedProfile = array();
|
||||||
$profilesExisting = false;
|
$profilesExisting = false;
|
||||||
if (sizeof($files) > 0) {
|
|
||||||
$profiles = $files;
|
$profiles = $files;
|
||||||
if (!empty($_COOKIE["lam_default_profile"]) && in_array($_COOKIE["lam_default_profile"], $files)) {
|
if (!empty($_COOKIE["lam_default_profile"]) && in_array($_COOKIE["lam_default_profile"], $files)) {
|
||||||
$selectedProfile[] = $_COOKIE["lam_default_profile"];
|
$selectedProfile[] = $_COOKIE["lam_default_profile"];
|
||||||
|
@ -171,43 +129,32 @@ $files = getConfigProfiles();
|
||||||
else {
|
else {
|
||||||
$selectedProfile[] = $conf->default;
|
$selectedProfile[] = $conf->default;
|
||||||
}
|
}
|
||||||
$profilesExisting = true;
|
$box->add(new htmlResponsiveSelect('filename', $profiles, $selectedProfile, _('Profile name')), 12);
|
||||||
$select = new htmlSelect('filename', $profiles, $selectedProfile);
|
$passwordInput = new htmlResponsiveInputField(_('Password'), 'passwd', '', '200');
|
||||||
$select->setIsEnabled($profilesExisting);
|
$passwordInput->setIsPassword(true);
|
||||||
$group->addElement($select);
|
$box->add($passwordInput, 12);
|
||||||
$passwordField = new htmlInputField('passwd');
|
$box->addVerticalSpacer('1rem');
|
||||||
$passwordField->setIsPassword(true);
|
|
||||||
$passwordField->setIsEnabled($profilesExisting);
|
|
||||||
$passwordField->setFieldSize(20);
|
|
||||||
$group->addElement($passwordField);
|
|
||||||
$button = new htmlButton('submit', _("Ok"));
|
$button = new htmlButton('submit', _("Ok"));
|
||||||
$button->setIsEnabled($profilesExisting);
|
$box->addLabel($button);
|
||||||
$group->addElement($button);
|
$box->add(new htmlOutputText(''), 0, 6);
|
||||||
$group->addElement(new htmlHelpLink('200'));
|
$box->addVerticalSpacer('1.5rem');
|
||||||
$tabindex = 1;
|
$box->add(new htmlHorizontalLine(), 12);
|
||||||
parseHtml(null, $group, array(), false, $tabindex, 'user');
|
$box->addVerticalSpacer('1.5rem');
|
||||||
}
|
}
|
||||||
|
$box->add(new htmlLink(_("Manage server profiles"), 'profmanage.php'), 12, 12, 12, 'text-center');
|
||||||
|
|
||||||
|
$boxDiv = new htmlDiv(null, $box);
|
||||||
|
$boxDiv->setCSSClasses(array('ui-corner-all', 'roundedShadowBox', 'limitWidth'));
|
||||||
|
$row->add($boxDiv, 12);
|
||||||
|
|
||||||
|
// back link
|
||||||
|
$row->addVerticalSpacer('2rem');
|
||||||
|
$backLink = new htmlLink(_("Back to login"), '../login.php', '../../graphics/undo.png');
|
||||||
|
$row->add($backLink, 12, 12, 12, 'text-left');
|
||||||
|
|
||||||
|
parseHtml(null, $row, array(), false, $tabindex, 'user');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</td>
|
|
||||||
<td style="border-style:none" rowspan="4" width="20"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="border-style:none"> </td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="border-style:none" align="center">
|
|
||||||
<b><a href="profmanage.php"><?php echo _("Manage server profiles") ?></a></b>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="border-style:none" height="20"></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</td></tr>
|
|
||||||
<tr><td>
|
|
||||||
<br><a href="../login.php"><IMG alt="configuration" src="../../graphics/undo.png"> <?php echo _("Back to login"); ?> </a>
|
|
||||||
</td></tr>
|
|
||||||
</table>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<p><br><br></p>
|
<p><br><br></p>
|
||||||
|
|
|
@ -19,7 +19,6 @@ use \htmlElement;
|
||||||
use \htmlSubTitle;
|
use \htmlSubTitle;
|
||||||
use \htmlButton;
|
use \htmlButton;
|
||||||
/*
|
/*
|
||||||
$Id$
|
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2003 - 2017 Roland Gruber
|
Copyright (C) 2003 - 2017 Roland Gruber
|
||||||
|
@ -73,7 +72,7 @@ if (isset($_POST['passwd'])) $passwd = $_POST['passwd'];
|
||||||
// check if password was entered
|
// check if password was entered
|
||||||
// if not: load login page
|
// if not: load login page
|
||||||
if (!isset($passwd) && !(isset($_SESSION['conf_isAuthenticated']) && isset($_SESSION['conf_config']))) {
|
if (!isset($passwd) && !(isset($_SESSION['conf_isAuthenticated']) && isset($_SESSION['conf_config']))) {
|
||||||
$_SESSION['conf_message'] = _("No password was entered!");
|
$_SESSION['conf_message'] = new htmlStatusMessage('ERROR', _("No password was entered!"));
|
||||||
/** go back to login if password is empty */
|
/** go back to login if password is empty */
|
||||||
metaRefresh('conflogin.php');
|
metaRefresh('conflogin.php');
|
||||||
exit;
|
exit;
|
||||||
|
@ -91,7 +90,7 @@ if ((!isset($_SESSION['conf_isAuthenticated']) || !($_SESSION['conf_isAuthentica
|
||||||
for ($i = 0; $i < sizeof($sessionKeys); $i++) {
|
for ($i = 0; $i < sizeof($sessionKeys); $i++) {
|
||||||
if (substr($sessionKeys[$i], 0, 5) == "conf_") unset($_SESSION[$sessionKeys[$i]]);
|
if (substr($sessionKeys[$i], 0, 5) == "conf_") unset($_SESSION[$sessionKeys[$i]]);
|
||||||
}
|
}
|
||||||
$_SESSION['conf_message'] = _("The password is invalid! Please try again.");
|
$_SESSION['conf_message'] = new htmlStatusMessage('ERROR', _("The password is invalid! Please try again."));
|
||||||
/** go back to login if password is invalid */
|
/** go back to login if password is invalid */
|
||||||
metaRefresh('conflogin.php');
|
metaRefresh('conflogin.php');
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
namespace LAM\CONFIG;
|
namespace LAM\CONFIG;
|
||||||
use \LAMConfig;
|
use \LAMConfig;
|
||||||
|
use \htmlStatusMessage;
|
||||||
/*
|
/*
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ if (isset($_POST['passwd'])) $passwd = $_POST['passwd'];
|
||||||
// check if password was entered
|
// check if password was entered
|
||||||
// if not: load login page
|
// if not: load login page
|
||||||
if (!isset($passwd) && !isset($_SESSION['conf_isAuthenticated'])) {
|
if (!isset($passwd) && !isset($_SESSION['conf_isAuthenticated'])) {
|
||||||
$_SESSION['conf_message'] = _("No password was entered!");
|
$_SESSION['conf_message'] = new htmlStatusMessage('ERROR', _("No password was entered!"));
|
||||||
/** go back to login if password is empty */
|
/** go back to login if password is empty */
|
||||||
require('conflogin.php');
|
require('conflogin.php');
|
||||||
exit;
|
exit;
|
||||||
|
@ -70,7 +71,7 @@ if ((!isset($_SESSION['conf_isAuthenticated']) || !($_SESSION['conf_isAuthentica
|
||||||
for ($i = 0; $i < sizeof($sessionKeys); $i++) {
|
for ($i = 0; $i < sizeof($sessionKeys); $i++) {
|
||||||
if (substr($sessionKeys[$i], 0, 5) == "conf_") unset($_SESSION[$sessionKeys[$i]]);
|
if (substr($sessionKeys[$i], 0, 5) == "conf_") unset($_SESSION[$sessionKeys[$i]]);
|
||||||
}
|
}
|
||||||
$_SESSION['conf_message'] = _("The password is invalid! Please try again.");
|
$_SESSION['conf_message'] = new htmlStatusMessage('ERROR', _("The password is invalid! Please try again."));
|
||||||
/** go back to login if password is invalid */
|
/** go back to login if password is invalid */
|
||||||
require('conflogin.php');
|
require('conflogin.php');
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2003 - 2016 Roland Gruber
|
Copyright (C) 2003 - 2017 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
Loading…
Reference in New Issue