use login from 0.4.3

This commit is contained in:
Roland Gruber 2004-02-16 17:02:01 +00:00
parent e5d670396e
commit 064bc914eb
1 changed files with 69 additions and 65 deletions

View File

@ -96,6 +96,7 @@ function display_LoginPage($config_object,$profile)
} }
else else
{ {
//TODO Generate Status message
$message = _("Unable to load available languages. Setting English as default language. For further instructions please contact the Admin of this site."); $message = _("Unable to load available languages. Setting English as default language. For further instructions please contact the Admin of this site.");
} }
@ -123,34 +124,31 @@ function display_LoginPage($config_object,$profile)
<?php <?php
if ((! function_exists('mHash')) && (! function_exists('sha1'))) { if ((! function_exists('mHash')) && (! function_exists('sha1'))) {
StatusMessage("INFO", "Your PHP does not support MHash or sha1(), you will only be able to use CRYPT/PLAIN/MD5/SMD5 for user passwords!", "Please install MHash or update to PHP >4.3."); StatusMessage("INFO", "Your PHP does not support MHash or sha1(), you will only be able to use CRYPT/PLAIN/MD5/SMD5 for user passwords!", "Please install MHash or update to PHP >4.3.");
}
?> ?>
<p align="center"> <br><br>
<b><?php echo _("Enter Username and Password for Account") . ":"; ?></b>
</p>
<?php
if($error_message != "") {
?>
<p align="center">
<?php
echo $error_message;
?>
</p>
<?php <?php
} }
?> ?>
<form action="login.php" method="post"> <form action="login.php" method="post">
<input type="hidden" name="action" value="checklogin"> <table width="650" align="center" border="2" rules="none" bgcolor="white">
<table width="500" align="center" border="0">
<tr> <tr>
<td width="45%" align="right"> <td style="border-style:none" width="70" rowspan="9">
<img src="../graphics/lam.png" alt="Logo">
</td>
<td style="border-style:none" height="70" colspan="2" align="center">
<font color="darkblue"><b><big><?php echo _("Enter Username and Password for Account"); ?></big></b></font>
</td>
<td style="border-style:none" rowspan="9" width="70">
&nbsp;
</td>
</tr>
<tr>
<td style="border-style:none" height="35" align="right"><b>
<?php <?php
echo _("Username") . ":"; echo _("Username") . ":";
?> ?>
</td> </b>&nbsp;&nbsp;</td>
<td width="10%"> <td style="border-style:none" height="35" align="left">
</td>
<td width="45%" align="left">
<select name="username" size="1"> <select name="username" size="1">
<?php <?php
$admins = $config_object->get_Admins(); $admins = $config_object->get_Admins();
@ -166,14 +164,12 @@ function display_LoginPage($config_object,$profile)
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="45%" align="right"> <td style="border-style:none" height="35" align="right"><b>
<?php <?php
echo _("Password") . ":"; echo _("Password") . ":";
?> ?>
</td> </b>&nbsp;&nbsp;</td>
<td width="10%"> <td style="border-style:none" height="35" align="left">
</td>
<td width="45%" align="left">
<input type="password" name="passwd"> <input type="password" name="passwd">
</td> </td>
</tr> </tr>
@ -181,25 +177,22 @@ function display_LoginPage($config_object,$profile)
<?php <?php
if($message != "") { if($message != "") {
?> ?>
<td width="100%" colspan="3" align="center"> <td height="35" colspan="3" align="center">
<?php <?php
echo $message; echo $message;
?> ?>
<input type="hidden" name="language" value="english">
</td> </td>
<?php <?php
} }
else else
{ {
?> ?>
<td width="45%" align="right"> <td style="border-style:none" align="right"><b>
<?php <?php
echo _("Your Language") . ":"; echo _("Your Language") . ":";
?> ?>
</td> </b>&nbsp;&nbsp;</td>
<td width="10%"> <td style="border-style:none" height="35" align="left">
</td>
<td width="45%" align="left">
<select name="language" size="1"> <select name="language" size="1">
<?php <?php
for($i = 0; $i < count($languages); $i++) { for($i = 0; $i < count($languages); $i++) {
@ -223,35 +216,40 @@ function display_LoginPage($config_object,$profile)
?> ?>
</tr> </tr>
<tr> <tr>
<td width="100%" colspan="3" align="center"> <td style="border-style:none" height="50" colspan="2" align="center">
<input type="submit" name="submit" value="<?php echo _("Login"); ?>"> <input name="checklogin" type="submit" value="<?php echo _("Login"); ?>">
</td> </td>
</tr> </tr>
</table>
<br><br>
<table width="345" align="center" bgcolor="#C7E7C7" border="0">
<tr> <tr>
<td width="100%" align="center"> <td style="border-style:none" height="50" colspan="2" align="center">
<?php <?php
echo _("You are connecting to ServerURL") . ": "; if($error_message != "") {
?> echo "<font color=\"red\"><b>" . $error_message . "</b></font>";
<b><?php echo $config_object->get_ServerURL(); ?></b>
</td>
</tr>
</table>
</form>
<br><br>
<form action="./login.php" method="post" enctype="plain/text">
<input type="hidden" name="action" value="profileChange">
<p align="center">
<?php
echo _("You are currently using Profile") . ": ";
if(!$_POST['profile']) {
$_POST['profile'] = $profile;
} }
?> ?>
<b><?php echo $_POST['profile']; ?></b> </td>
<br> </tr>
<tr>
<td style="border-style:none" height="30" colspan="2">
<hr>
<b>
<?php
echo _("LDAP server") . ": ";
?></b>
<?php echo $config_object->get_ServerURL(); ?>
</td>
</tr>
<tr>
<td style="border-style:none" height="30"><b>
<?php
echo _("Configuration profile") . ": ";
if(!$_POST['profileChange']) {
$_POST['profile'] = $_SESSION['config']->file;
}
?></b>
<?php echo $_POST['profile']; ?>
</td>
<td style="border-style:none" height="30" align="right">
<select name="profile" size="1"> <select name="profile" size="1">
<?php <?php
for($i=0;$i<count($profiles);$i++) { for($i=0;$i<count($profiles);$i++) {
@ -261,16 +259,22 @@ function display_LoginPage($config_object,$profile)
} }
?> ?>
</select> </select>
<input type="submit" value="<?php echo _("Change Profile"); ?>"> <input name="profileChange" type="submit" value="<?php echo _("Change Profile"); ?>">
</p> </td>
</tr>
<tr>
<td style="border-style:none" height="10" colspan="2"></td>
</tr>
</table>
</form> </form>
<br><br>
</body> </body>
</html> </html>
<?php <?php
} }
// checking if the submitted username/password is correct. // checking if the submitted username/password is correct.
if($_POST['action'] == "checklogin") if($_POST['checklogin'])
{ {
$_SESSION['lampath'] = realpath('../') . "/"; // Save full path to lam in session $_SESSION['lampath'] = realpath('../') . "/"; // Save full path to lam in session
@ -326,7 +330,7 @@ if($_POST['action'] == "checklogin")
} }
} }
// Reload loginpage after a profile change // Reload loginpage after a profile change
elseif($_POST['action'] == "profileChange") { elseif($_POST['profileChange']) {
$_SESSION['config'] = new Config($_POST['profile']); // Recreate the config object with the submited $_SESSION['config'] = new Config($_POST['profile']); // Recreate the config object with the submited
display_LoginPage($_SESSION['config'],""); // Load login page display_LoginPage($_SESSION['config'],""); // Load login page