phpldapadmin/htdocs/login_form.php

104 lines
3.2 KiB
PHP
Raw Normal View History

2009-06-30 09:22:30 +00:00
<?php
2009-06-30 10:40:03 +00:00
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login_form.php,v 1.27 2005/12/17 00:00:11 wurley Exp $
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
/**
* Displays the login form for a server for users who specify 'cookie' or 'session' for their auth_type.
2009-06-30 08:05:37 +00:00
*
2009-06-30 09:29:51 +00:00
* Variables that come in via common.php
* - server_id
*
* @package phpLDAPadmin
* @author The phpLDAPadmin development team
* @see login.php
*/
/**
2009-06-30 08:05:37 +00:00
*/
2009-06-30 09:22:30 +00:00
require './common.php';
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
if (! $ldapserver->auth_type)
2009-06-30 10:26:08 +00:00
pla_error(_('Error: You have an error in your config file. The only three allowed values
for auth_type in the $servers section are \'session\', \'cookie\', and \'config\'. You entered \'%s\',
which is not allowed. '));
2009-06-30 09:29:51 +00:00
if (! in_array($ldapserver->auth_type, array('cookie','session')))
2009-06-30 10:26:08 +00:00
pla_error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($ldapserver->auth_type)));
2009-06-30 09:22:30 +00:00
include './header.php'; ?>
2009-06-30 08:05:37 +00:00
2009-06-30 09:22:30 +00:00
<body>
2009-06-30 09:29:51 +00:00
<?php if( $ldapserver->isAnonBindAllowed() ) { ?>
2009-06-30 10:26:08 +00:00
<script type="text/javascript" language="javascript">
2009-06-30 08:05:37 +00:00
<!--
function toggle_disable_login_fields( anon_checkbox )
{
2009-06-30 08:10:17 +00:00
if( anon_checkbox.checked ) {
2009-06-30 09:29:51 +00:00
anon_checkbox.form.<?php echo $ldapserver->isLoginAttrEnabled() ? 'uid' : 'login_dn'; ?>.disabled = true;
2009-06-30 08:05:37 +00:00
anon_checkbox.form.login_pass.disabled = true;
} else {
2009-06-30 09:29:51 +00:00
anon_checkbox.form.<?php echo $ldapserver->isLoginAttrEnabled() ? 'uid' : 'login_dn'; ?>.disabled = false;
2009-06-30 08:05:37 +00:00
anon_checkbox.form.login_pass.disabled = false;
}
}
-->
</script>
2009-06-30 09:22:30 +00:00
<?php } ?>
2009-06-30 08:05:37 +00:00
2009-06-30 10:26:08 +00:00
<h3 class="title"><?php printf(_('Authenticate to server %s'),$ldapserver->name); ?></h3>
2009-06-30 08:05:37 +00:00
<br />
2009-06-30 09:29:51 +00:00
<?php if (! isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') { ?>
2009-06-30 08:07:14 +00:00
<center>
2009-06-30 09:22:30 +00:00
<span style="color:red">
2009-06-30 10:26:08 +00:00
<acronym title="<?php echo _('You are not using \'https\'. Web browser will transmit login information in clear text.'); ?>">
<?php echo _('Warning: This web connection is unencrypted.'); ?>
2009-06-30 09:22:30 +00:00
</acronym>
2009-06-30 09:29:51 +00:00
</span>
<br />
</center>
<?php } ?>
2009-06-30 08:05:37 +00:00
<br />
<form action="login.php" method="post" name="login_form">
2009-06-30 09:29:51 +00:00
<input type="hidden" name="server_id" value="<?php echo $ldapserver->server_id; ?>" />
2009-06-30 08:09:20 +00:00
<?php if( isset( $_GET['redirect'] ) ) { ?>
2009-06-30 09:29:51 +00:00
<input type="hidden" name="redirect" value="<?php echo rawurlencode( $_GET['redirect'] ) ?>" />
2009-06-30 08:05:37 +00:00
<?php } ?>
2009-06-30 09:29:51 +00:00
2009-06-30 08:05:37 +00:00
<center>
<table class="login">
2009-06-30 09:29:51 +00:00
2009-06-30 10:40:03 +00:00
<?php if( $ldapserver->isAnonBindAllowed() ) { ?>
<tr>
<td colspan="2"><small><label for="anonymous_bind_checkbox"><?php echo _('Anonymous Bind'); ?></label></small> <input type="checkbox" name="anonymous_bind" onclick="toggle_disable_login_fields(this)" id="anonymous_bind_checkbox"/></td>
</tr>
<?php } ?>
2009-06-30 08:05:37 +00:00
<tr>
2009-06-30 09:29:51 +00:00
<td><small>
<?php
if ($ldapserver->isLoginAttrEnabled())
2009-06-30 10:26:08 +00:00
echo _('User name');
2009-06-30 09:29:51 +00:00
else
2009-06-30 10:26:08 +00:00
echo _('Login DN');
2009-06-30 09:29:51 +00:00
?>
</small></td>
<td><input type="text" name="<?php echo $ldapserver->isLoginAttrEnabled() ? 'uid' : 'login_dn'; ?>" size="40" value="<?php echo $ldapserver->isLoginAttrEnabled() ? '' : $ldapserver->login_dn; ?>" /></td>
2009-06-30 08:05:37 +00:00
</tr>
2009-06-30 09:29:51 +00:00
2009-06-30 08:05:37 +00:00
<tr>
2009-06-30 10:26:08 +00:00
<td><small><?php echo _('Password'); ?></small></td>
2009-06-30 09:22:30 +00:00
<td><input type="password" size="40" value="" name="login_pass" /></td>
2009-06-30 08:05:37 +00:00
</tr>
2009-06-30 09:29:51 +00:00
2009-06-30 08:05:37 +00:00
<tr>
2009-06-30 10:40:03 +00:00
<td colspan="2"><center><input type="submit" name="submit" value="<?php echo _('Authenticate'); ?>" /></center></td>
2009-06-30 08:05:37 +00:00
</tr>
</table>
</center>
2009-06-30 09:22:30 +00:00
</form>
</body>
</html>