summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dc124a1)
raw | patch | inline | side by side (parent: dc124a1)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 31 May 2006 13:35:17 +0000 (13:35 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 31 May 2006 13:35:17 +0000 (13:35 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3586 594d385d-05f5-0310-b6e9-bd551577e9d8
index 27bf74f60563e659b050723e8aad7f221e4d7037..8ddb47225bc5ac8a1f0e0c64abf7780cf4428252 100644 (file)
--- a/TODO
+++ b/TODO
* Change FAIstate when triggering actions
(install, sysinfo, softupdate)
-* Fix error messages on login
-
* Fix DNS plugin
* Zones are not creatable, currently
* Error messages are partly wrong
diff --git a/html/index.php b/html/index.php
index 63fb9db9111747c0d5e187edf96ab3307e737736..16e0c94beed5f4894395637e31082c630b3286d4 100644 (file)
--- a/html/index.php
+++ b/html/index.php
require_once ("functions.inc");
header("Content-type: text/html; charset=UTF-8");
+function displayLogin()
+{
+ global $smarty,$message,$config,$ssl,$error_collector;
+ error_reporting(E_ALL);
+ /* Fill template with required values */
+ $username = "";
+ if(isset($_POST["username"])){
+ $username= $_POST["username"];
+ }
+ $smarty->assign ('date', gmdate("D, d M Y H:i:s"));
+ $smarty->assign ('username', $username);
+ $smarty->assign ('personal_img', get_template_path('images/personal.png'));
+ $smarty->assign ('password_img', get_template_path('images/password.png'));
+ $smarty->assign ('directory_img', get_template_path('images/ldapserver.png'));
+
+ /* Some error to display? */
+ if (!isset($message)){
+ $message= "";
+ }
+ $smarty->assign ("message", $message);
+
+ /* Displasy SSL mode warning? */
+ if ($ssl != "" && $config->data['MAIN']['WARNSSL'] == 'true'){
+ $smarty->assign ("ssl", "<b>"._("Warning").":</b> "._("Session will not be encrypted.")." <a style=\"color:red;\" href=\"$ssl\"><b>"._("Enter SSL session")."</b></a>!");
+ } else {
+ $smarty->assign ("ssl", "");
+ }
+
+ /* Generate server list */
+ $servers= array();
+ if (isset($_POST['server'])){
+ $selected= validate($_POST['server']);
+ } else {
+ $selected= $config->data['MAIN']['DEFAULT'];
+ }
+ foreach ($config->data['LOCATIONS'] as $key => $ignored){
+ $servers[$key]= $key;
+ }
+ $smarty->assign ("server_options", $servers);
+ $smarty->assign ("server_id", $selected);
+
+ /* show login screen */
+ $smarty->assign ("PHPSESSID", session_id());
+ if (isset($_SESSION['errors'])){
+ $smarty->assign("errors", $_SESSION['errors']);
+ }
+ if ($error_collector != ""){
+ $smarty->assign("php_errors", $error_collector."</div>");
+ } else {
+ $smarty->assign("php_errors", "");
+ }
+
+ $smarty->display (get_template_path('headers.tpl'));
+ $smarty->display(get_template_path('login.tpl'));
+ exit();
+}
+
+
+
/* Set error handler to own one, initialize time calculation
and start session. */
session_start ();
$ldap = $config->get_ldap_link();
if (is_null($ldap) || (is_int($ldap) && $ldap == 0)){
print_red (_("Can't bind to LDAP. Please contact the system administrator."));
- echo $_SESSION['errors'];
- $smarty->display(get_template_path('login.tpl'));
+ displayLogin();
exit();
}
require_once("functions_setup.inc");
if(!is_schema_readable($config->current['SERVER'],$config->current['ADMIN'],$config->current['PASSWORD'])){
print_red(_("GOsa cannot retrieve information about the installed schema files. Please make sure, that this is possible."));
- echo $_SESSION['errors'];
+ $smarty->display(get_template_path('headers.tpl'));
+ echo "<body>".$_SESSION['errors']."</body></html>";
exit();
}else{
$str = (schema_check($config->current['SERVER'],$config->current['ADMIN'],$config->current['PASSWORD'],0,TRUE));
foreach($str as $tr){
if(isset($tr['needonstartup'])){
print_red($tr['msg']."<br>"._("Your ldap setup contains old schema definitions. Please re-run the setup."));
- print $_SESSION['errors'];
+ $smarty->display(get_template_path('headers.tpl'));
+ echo "<body>".$_SESSION['errors']."</body></html>";
exit();
}
}
} else {
$smarty->assign("php_errors", "");
}
-$smarty->display (get_template_path('login.tpl'));
-
-
-
-
-
-
-
-function displayLogin()
-{
- global $smarty,$message,$config,$ssl,$error_collector;
- error_reporting(E_ALL);
- /* Fill template with required values */
- $username = "";
- if(isset($_POST["username"])){
- $username= $_POST["username"];
- }
- $smarty->assign ('date', gmdate("D, d M Y H:i:s"));
- $smarty->assign ('username', $username);
- $smarty->assign ('personal_img', get_template_path('images/personal.png'));
- $smarty->assign ('password_img', get_template_path('images/password.png'));
- $smarty->assign ('directory_img', get_template_path('images/ldapserver.png'));
-
- /* Some error to display? */
- if (!isset($message)){
- $message= "";
- }
- $smarty->assign ("message", $message);
-
- /* Displasy SSL mode warning? */
- if ($ssl != "" && $config->data['MAIN']['WARNSSL'] == 'true'){
- $smarty->assign ("ssl", "<b>"._("Warning").":</b> "._("Session will not be encrypted.")." <a style=\"color:red;\" href=\"$ssl\"><b>"._("Enter SSL session")."</b></a>!");
- } else {
- $smarty->assign ("ssl", "");
- }
-
- /* Generate server list */
- $servers= array();
- if (isset($_POST['server'])){
- $selected= validate($_POST['server']);
- } else {
- $selected= $config->data['MAIN']['DEFAULT'];
- }
- foreach ($config->data['LOCATIONS'] as $key => $ignored){
- $servers[$key]= $key;
- }
- $smarty->assign ("server_options", $servers);
- $smarty->assign ("server_id", $selected);
-
- /* show login screen */
- $smarty->display (get_template_path('headers.tpl'));
- $smarty->assign ("PHPSESSID", session_id());
- if (isset($_SESSION['errors'])){
- $smarty->assign("errors", $_SESSION['errors']);
- }
- if ($error_collector != ""){
- $smarty->assign("php_errors", $error_collector."</div>");
- } else {
- $smarty->assign("php_errors", "");
- }
-
- $smarty->display(get_template_path('login.tpl'));
- exit();
-}
-
+displayLogin();
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
diff --git a/html/main.php b/html/main.php
index 212707878f2312e3a49084ed83ca47a17c87c803..e43f2aaeb104149ffc1c5b3d6bc85e9e71146f32 100644 (file)
--- a/html/main.php
+++ b/html/main.php
header ("Location: logout.php");
exit;
}
-// echo "Session was ".$request_time." s inactive";
$_SESSION['_LAST_PAGE_REQUEST'] = time();
}
/* Check for register globals */
if (isset($global_check) && $config->data['MAIN']['FORCEGLOBALS'] == 'true'){
- print_red (_("Register globals is on. GOsa will refuse to login unless this is fixed by an administrator."));
- echo $_SESSION['errors'];
+ echo _("FATAL: Register globals is on. GOsa will refuse to login unless this is fixed by an administrator.");
gosa_log ("Register globals is on. For security reasons, this should be turned off.");
session_destroy ();
exit ();
if (is_file("$plugin_dir/main.inc")){
require_once ("$plugin_dir/main.inc");
} else {
- print_red(sprintf(_("Can't find any plugin definitions for plugin '%s'!"), $plug));
- echo $_SESSION['errors'];
+ echo sprintf(_("FATAL: Can't find any plugin definitions for plugin '%s'!"), $plug);
exit();
}
}
}
-/* Print_out last ErrorMessage repeated string.
- */
+/* Print_out last ErrorMessage repeated string. */
print_red(NULL);
$smarty->assign("contents", $display);
index 7c771cb1d756854c6b6ecb6e94865db1e5a036c0..2f8c0dbf6f4b1c61f7dcdadb73de75ad930f66f2 100644 (file)
<body style="background-color: #8B858B;background-image:none;">
{* GOsa login - smarty template *}
{$php_errors}
-{$errors}
<!-- Spacer for some browsers -->
<div class='gosaLoginSpacer'></div>
<!-- Formular data, containing a table to center fields -->
<form action='index.php' method='post' name='mainform' onSubmit='js_check(this);return true;'>
+ {$errors}
<table summary="" style='vertical-align:middle; text-align:left;' cellspacing='7' align='center'>
<tr>
<td>
index 6d028a11b5cfe9a39317bb30b868ff631b57cbf0..88754e06908d1a0b259313bce8b353295fc34571 100644 (file)
--- a/include/class_config.inc
+++ b/include/class_config.inc
/* Check for connection */
if (is_null($this->ldap) || (is_int($this->ldap) && $this->ldap == 0)){
+ $smarty= get_smarty();
print_red (_("Can't bind to LDAP. Please contact the system administrator."));
- echo $_SESSION['errors'];
- exit;
+ $smarty->display (get_template_path('headers.tpl'));
+ echo '<body style="background-image:none">'.$_SESSION['errors'].'</body></html>';
+ exit();
}
if (!isset($_SESSION['size_limit'])){
diff --git a/include/functions.inc b/include/functions.inc
index 8588391b83b68c7e2b80a306088d13ff051f69d2..d6518ba9033fa315b2ae6769663ec4aa3d23fbc7 100644 (file)
--- a/include/functions.inc
+++ b/include/functions.inc
/* Sadly we've no proper return values here. Use the error message instead. */
if (!preg_match("/Success/i", $ldap->error)){
- print_red(sprintf(_("Error when connecting the LDAP. Server said '%s'."),
- $ldap->get_error()));
- echo $_SESSION['errors'];
-
- /* Hard error. We'd like to use the LDAP, anyway... */
- exit;
+ echo sprintf(_("FATAL: Error when connecting the LDAP. Server said '%s'."), $ldap->get_error()));
+ exit();
}
/* Preset connection base to $base and return to caller */
$ldap = $config->get_ldap_link();
if (!preg_match("/Success/i", $ldap->error)){
print_red(sprintf(_("User login failed. LDAP server said '%s'."), $ldap->get_error()));
- echo $_SESSION['errors'];
- exit;
+ $smarty= get_smarty();
+ $smarty->display(get_template_path('headers.tpl'));
+ echo "<body>".$_SESSION['errors']."</body></html>";
+ exit();
}
$ldap->cd($config->current['BASE']);
$ldap->search("(&(uid=$username)(objectClass=gosaAccount))", array("uid"));