fix problem if no profile exists

This commit is contained in:
Roland Gruber 2013-01-05 16:08:51 +00:00
parent bad83b9ef2
commit dba2d5e104
1 changed files with 15 additions and 7 deletions

View File

@ -4,7 +4,7 @@ $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 - 2006 Michael Duergner Copyright (C) 2003 - 2006 Michael Duergner
2005 - 2012 Roland Gruber 2005 - 2013 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
@ -80,7 +80,7 @@ if(isset($_GET['useProfile'])) {
$_SESSION['config'] = new LAMConfig($_GET['useProfile']); // Recreate the config object with the submited $_SESSION['config'] = new LAMConfig($_GET['useProfile']); // Recreate the config object with the submited
} }
// Load login page // Load login page
else { elseif (!empty($default_Profile)) {
$_SESSION["config"] = new LAMConfig($default_Profile); // Create new Config object $_SESSION["config"] = new LAMConfig($default_Profile); // Create new Config object
} }
@ -202,6 +202,7 @@ function display_LoginPage($config_object) {
copyConfigTemplates(getConfigProfiles()); copyConfigTemplates(getConfigProfiles());
// set focus on password field // set focus on password field
if (!empty($config_object)) {
echo "<script type=\"text/javascript\" language=\"javascript\">\n"; echo "<script type=\"text/javascript\" language=\"javascript\">\n";
echo "<!--\n"; echo "<!--\n";
echo "function focusLogin() {\n"; echo "function focusLogin() {\n";
@ -221,6 +222,7 @@ function display_LoginPage($config_object) {
<?php <?php
echo "//-->\n"; echo "//-->\n";
echo "</script>\n"; echo "</script>\n";
}
?> ?>
<script type="text/javascript"> <script type="text/javascript">
@ -253,11 +255,13 @@ function display_LoginPage($config_object) {
} }
} }
// check TLS // check TLS
$useTLS = $config_object->getUseTLS(); if (!empty($config_object)) {
if (isset($useTLS) && ($useTLS == "yes")) { $useTLS = $config_object->getUseTLS();
if (!function_exists('ldap_start_tls')) { if (isset($useTLS) && ($useTLS == "yes")) {
StatusMessage("ERROR", "Your PHP installation does not support TLS encryption!"); if (!function_exists('ldap_start_tls')) {
echo "<br>"; StatusMessage("ERROR", "Your PHP installation does not support TLS encryption!");
echo "<br>";
}
} }
} }
// check if session expired // check if session expired
@ -284,6 +288,7 @@ function display_LoginPage($config_object) {
StatusMessage("INFO", _("Your settings were successfully saved."), htmlspecialchars($_GET['selfserviceSaveOk'])); StatusMessage("INFO", _("Your settings were successfully saved."), htmlspecialchars($_GET['selfserviceSaveOk']));
echo "<br>"; echo "<br>";
} }
if (!empty($config_object)) {
?> ?>
<br><br> <br><br>
<div style="position:relative; z-index:5;"> <div style="position:relative; z-index:5;">
@ -422,6 +427,9 @@ function display_LoginPage($config_object) {
</tr> </tr>
</table> </table>
</div> </div>
<?php
}
?>
<br><br> <br><br>
<TABLE style="position:absolute; bottom:10px;" border="0" width="99%"> <TABLE style="position:absolute; bottom:10px;" border="0" width="99%">
<tr><td colspan=2><HR></td></tr> <tr><td colspan=2><HR></td></tr>