Skip to content
Browse files

A significant new system for authentication configuration that

exposes the wide array of authentication possibilities.

Authentication now has it's own page separate from other variables.

Most of this work was done by Petri Asikainen <paca@sci.fi>, who started
these changes off.

I've done some cleanups and additions which is why I'm checking it in.

It's all working pretty well at the moment but could use some testing.

Thanks, Petri!  :-)
  • Loading branch information...
1 parent dfe952f commit 35a48c9ae4d94c79a9b7fa9e8802e624c7bf6987 moodler committed Nov 19, 2002
View
135 admin/auth.php
@@ -0,0 +1,135 @@
+<?PHP // $Id$
+ // config.php - allows admin to edit all configuration variables
+
+ include("../config.php");
+
+ require_login();
+
+ if (!$site = get_site()) {
+ redirect("index.php");
+ }
+
+ if (!isadmin()) {
+ error("Only the admin can use this page");
+ }
+
+
+/// If data submitted, then process and store.
+
+ if (match_referer() && isset($HTTP_POST_VARS)) {
+
+ $config = (object)$HTTP_POST_VARS;
+
+ validate_form($config, $err);
+
+ if (count($err) == 0) {
+ print_header();
+ foreach ($config as $name => $value) {
+ unset($conf);
+ $conf->name = $name;
+ $conf->value = $value;
+ if ($current = get_record("config", "name", $name)) {
+ $conf->id = $current->id;
+ if (! update_record("config", $conf)) {
+ notify("Could not update $name to $value");
+ }
+ } else {
+ if (! insert_record("config", $conf)) {
+ notify("Error: could not add new variable $name !");
+ }
+ }
+ }
+ redirect("auth.php", get_string("changessaved"), 1);
+ exit;
+
+ } else {
+ foreach ($err as $key => $value) {
+ $focus = "form.$key";
+ }
+ }
+ }
+
+/// Otherwise fill and print the form.
+
+ if (!isset($config)) {
+ $config = $CFG;
+ }
+
+ $modules = get_list_of_plugins("auth");
+ foreach ($modules as $module) {
+ $options[$module] = get_string("auth_$module"."title", "auth");
+ }
+ asort($options);
+ if (isset($_GET['auth'])) {
+ $auth = $_GET['auth'];
+ } else {
+ $auth = $config->auth;
+ }
+
+ if (! isset($config->guestloginbutton)) {
+ $config->guestloginbutton = 1;
+ }
+ $guestoptions[0] = get_string("hide");
+ $guestoptions[1] = get_string("show");
+
+ $stradministration = get_string("administration");
+ $strauthentication = get_string("authentication");
+ $strauthenticationoptions = get_string("authenticationoptions","auth");
+ $strsettings = get_string("settings");
+
+ print_header("$site->shortname: $strauthenticationoptions", "$site->fullname",
+ "<A HREF=\"index.php\">$stradministration</A> -> $strauthenticationoptions", "$focus");
+
+ echo "<CENTER><P><B>";
+ echo "<form TARGET=\"_top\" NAME=\"authmenu\" method=\"post\" action=\"auth.php\">";
+ print_string("chooseauthmethod","auth");
+
+ choose_from_menu ($options, "auth", $auth, "","top.location='auth.php?auth='+document.authmenu.auth.options[document.authmenu.auth.selectedIndex].value", "");
+
+ echo "</B></P></CENTER>";
+
+ print_simple_box_start("center", "100%", "$THEME->cellheading");
+ print_heading($options[$auth]);
+
+ echo "<CENTER><P>";
+ print_string("auth_$auth"."description", "auth");
+ echo "</P></CENTER>";
+
+ echo "<HR>";
+
+ print_heading($strsettings);
+
+ echo "<table border=\"0\" width=\"100%\" cellpadding=\"4\">";
+
+ require("$CFG->dirroot/auth/$auth/config.html");
+
+ echo "<tr valign=\"top\">";
+ echo "<td align=right><p>guestloginbutton:</p></td>";
+ echo "<td>";
+ choose_from_menu($guestoptions, "guestloginbutton", $config->guestloginbutton, "");
+ echo "</td>";
+ echo "<td>";
+ print_string("showguestlogin","auth");
+ echo "</td></tr></table>";
+
+ echo "<CENTER><P><INPUT TYPE=\"submit\" VALUE=\"";
+ print_string("savechanges");
+ echo "\"></P></CENTER></FORM>";
+
+ print_simple_box_end();
+
+ print_footer();
+ exit;
+
+/// Functions /////////////////////////////////////////////////////////////////
+
+function validate_form(&$form, &$err) {
+
+ // if (empty($form->fullname))
+ // $err["fullname"] = get_string("missingsitename");
+
+ return;
+}
+
+
+?>
View
16 admin/config.html
@@ -2,22 +2,6 @@
<TABLE cellpadding=9 cellspacing=0 >
<TR VALIGN=TOP>
- <TD ALIGN=RIGHT><P>auth:</TD>
- <TD>
- <? $modules = get_list_of_plugins("auth");
- foreach ($modules as $module) {
- $options[$module] = $module;
- }
- choose_from_menu ($options, "auth", $config->auth, "", "", "");
- formerr($err["auth"]);
- unset($options);
- ?>
- </TD>
- <TD>
- <? print_string("configauth") ?>
- </TD>
-</TR>
-<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P>lang:</TD>
<TD>
<? choose_from_menu (get_list_of_languages(), "lang", $config->lang, "", "", "");
View
3 admin/index.php
@@ -251,7 +251,8 @@
"<P><A HREF=\"../course/delete.php\">".get_string("deletecourse")."</A></P>".
"<P><A HREF=\"../course/categories.php\">".get_string("categories")."</A></P>";
$table->data[0][2] = "<P><A HREF=\"user.php?newuser=true\">".get_string("addnewuser")."</A></P>".
- "<P><A HREF=\"user.php\">".get_string("edituser")."</A></P>";
+ "<P><A HREF=\"user.php\">".get_string("edituser")."</A></P>".
+ "<P><A HREF=\"auth.php\">".get_string("authentication")."</A></P>";
print_table($table);
View
100 auth/db/config.html
@@ -0,0 +1,100 @@
+<tr valign="top">
+ <TD ALIGN=RIGHT><P>auth_dbhost:</TD>
+ <TD>
+ <INPUT name=auth_dbhost TYPE=text SIZE=30 VALUE="<?=$config->auth_dbhost?>">
+ <? formerr($err["auth_dbhost"]); ?>
+ </TD>
+ <TD>
+ <? print_string("auth_dbhost","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>auth_dbtype:</TD>
+ <TD>
+ <? $dbtypes = array("access","ado_access", "ado", "ado_mssql", "borland_ibase", "csv", "db2", "fbsql", "firebird", "ibase", "informix72", "informix", "mssql", "mysql", "mysqlt", "oci805", "oci8", "oci8po", "odbc", "odbc_mssql", "odbc_oracle", "oracle", "postgres64", "postgres7", "postgres", "proxy", "sqlanywhere", "sybase", "vfp");
+ choose_from_menu($dbtypes, "auth_dbtype", $config->auth_dbtype, "");
+ ?>
+
+ </TD>
+ <TD>
+ <? print_string("auth_dbtype","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>auth_dbname:</TD>
+ <TD>
+ <INPUT name=auth_dbname TYPE=text SIZE=30 VALUE="<?=$config->auth_dbname?>">
+ <? formerr($err["auth_dbname"]); ?>
+ </TD>
+ <TD>
+ <? print_string("auth_dbname","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>auth_dbuser:</TD>
+ <TD>
+ <INPUT name=auth_dbuser TYPE=text SIZE=30 VALUE="<?=$config->auth_dbuser?>">
+ <? formerr($err["auth_dbuser"]); ?>
+ </TD>
+ <TD>
+ <? print_string("auth_dbuser","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>auth_dbpass:</TD>
+ <TD>
+ <INPUT name="auth_dbpass" TYPE="text" SIZE="30" VALUE="<?=$config->auth_dbpass?>">
+ <? formerr($err["auth_dbpass"]); ?>
+ </TD>
+ <TD>
+ <? print_string("auth_dbpass","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>auth_dbtable:</TD>
+ <TD>
+ <INPUT name="auth_dbtable" TYPE="text" SIZE="30" VALUE="<?=$config->auth_dbtable?>">
+ <? formerr($err["auth_dbtable"]); ?>
+ </TD>
+ <TD>
+ <? print_string("auth_dbtable","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>auth_dbfielduser:</TD>
+ <TD>
+ <INPUT name="auth_dbfielduser" TYPE="text" SIZE="30" VALUE="<?=$config->auth_dbfielduser?>">
+ <? formerr($err["auth_dbfielduser"]); ?>
+ </TD>
+ <TD>
+ <? print_string("auth_dbfielduser","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>auth_dbfieldpass:</TD>
+ <TD>
+ <INPUT name="auth_dbfieldpass" TYPE="text" SIZE="30" VALUE="<?=$config->auth_dbfieldpass?>">
+ <? formerr($err["auth_dbfieldpass"]); ?>
+ </TD>
+ <TD>
+ <? print_string("auth_dbfieldpass","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>auth_instructions:</TD>
+ <TD>
+ <TEXTAREA NAME=auth_instructions COLS=30 ROWS=10 WRAP=virtual><? p($config->auth_instructions) ?></TEXTAREA>
+ </TD>
+ <TD>
+ <? print_string("authinstructions","auth") ?>
+ <? helpbutton("text", get_string("helptext")) ?>
+ </TD>
+</TR>
View
9 auth/db/lib.php
@@ -4,15 +4,6 @@
// This code is completely untested so far - IT NEEDS TESTERS!
// Looks like it should work though ...
-$CFG->auth_dbhost = "localhost"; // The computer hosting the database server
-$CFG->auth_dbtype = "mysql"; // The database type (mysql, postgres7, access, oracle etc)
-$CFG->auth_dbname = "authtest"; // Name of the database itself
-$CFG->auth_dbuser = "user"; // Username with read access to the database
-$CFG->auth_dbpass = "pass"; // Password matching the above username
-$CFG->auth_dbtable = "users"; // Name of the table in the database
-$CFG->auth_dbfielduser = "user"; // Name of the field containing usernames
-$CFG->auth_dbfieldpass = "pass"; // Name of the field containing passwords
-$CFG->auth_instructions = "Use the same username and password as your school account"; // Instructions
function auth_user_login ($username, $password) {
// Returns true if the username and password work
View
1 auth/email/config.html
@@ -0,0 +1 @@
+<!-- No config needed -->
View
44 auth/imap/config.html
@@ -0,0 +1,44 @@
+<tr valign="top">
+ <TD ALIGN=RIGHT><P>auth_imaphost:</TD>
+ <TD>
+ <INPUT name=auth_imaphost TYPE=text SIZE=30 VALUE="<?=$config->auth_imaphost?>">
+ <? formerr($err["ldap_host_url"]); ?>
+ </TD>
+ <TD>
+ <? print_string("auth_imaphost","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>auth_imaptype:</TD>
+ <TD>
+ <? $imaptypes = array("imap","imapssl", "imapcert", "imaptls");
+ choose_from_menu($imaptypes, "auth_imaptype", $config->auth_imaptype, "");
+ ?>
+ </TD>
+ <TD>
+ <? print_string("auth_imaptype","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>auth_imapport:</TD>
+ <TD>
+ <INPUT name=auth_imapport TYPE=text SIZE=6 VALUE="<?=$config->auth_imapport?>">
+ <? formerr($err["auth_imapport"]); ?>
+ </TD>
+ <TD>
+ <? print_string("auth_imapport","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>auth_instructions:</TD>
+ <TD>
+ <TEXTAREA NAME=auth_instructions COLS=30 ROWS=10 WRAP=virtual><? p($config->auth_instructions) ?></TEXTAREA>
+ </TD>
+ <TD>
+ <? print_string("authinstructions","auth") ?>
+ <? helpbutton("text", get_string("helptext")) ?>
+ </TD>
+</TR>
View
21 auth/imap/lib.php
@@ -1,15 +1,6 @@
<?PHP // $Id$
// Authentication by looking up an IMAP server
-// This code is completely untested so far - IT NEEDS TESTERS!
-// Looks like it should work though ...
-
-$CFG->auth_imaphost = "127.0.0.1"; // Should be IP number
-$CFG->auth_imaptype = "imap"; // imap, imaptls, imapssl, imapcert
-$CFG->auth_imapport = "143"; // 143, 993
-$CFG->auth_instructions = "Use the same username and password as your school email account"; // Instructions
-
-
function auth_user_login ($username, $password) {
// Returns true if the username and password work
// and false if they are wrong or don't exist.
@@ -18,22 +9,26 @@ function auth_user_login ($username, $password) {
switch ($CFG->auth_imaptype) {
case "imapssl":
- $host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport/imap/ssl}INBOX";
+ $host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport/imap/ssl}";
break;
case "imapcert":
- $host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport/imap/ssl/novalidate-cert}INBOX";
+ $host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport/imap/ssl/novalidate-cert}";
break;
case "imaptls":
- $host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport/imap/notls}INBOX";
+ $host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport/imap/notls}";
break;
default:
$host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport}";
}
- if ($connection = imap_open($host, $username, $password, OP_HALFOPEN)) {
+ error_reporting(0);
+ $connection = imap_open($host, $username, $password, OP_HALFOPEN);
+ error_reporting(7);
+
+ if ($connection) {
imap_close($connection);
return true;
View
74 auth/ldap/config.html
@@ -0,0 +1,74 @@
+<tr valign="top">
+ <TD ALIGN=RIGHT><P>ldap_host_url:</TD>
+ <TD>
+ <INPUT name=ldap_host_url TYPE=text SIZE=30 VALUE="<?=$config->ldap_host_url?>">
+ <? formerr($err["ldap_host_url"]); ?>
+ </TD>
+ <TD>
+ <? print_string("auth_ldap_host_url","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>ldap_user_context(s):</TD>
+ <TD>
+ <INPUT name=ldap_contexts TYPE=text SIZE=30 VALUE="<?=$config->ldap_contexts?>">
+ <? formerr($err["ldap_contexts"]); ?>
+ </TD>
+ <TD>
+ <? print_string("auth_ldap_contexts","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>ldap_user_attribute(s):</TD>
+ <TD>
+ <INPUT name=ldap_user_attribute TYPE=text SIZE=30 VALUE="<?=$config->ldap_user_attribute?>">
+ <? formerr($err["ldap_user_attribute"]); ?>
+ </TD>
+ <TD>
+ <? print_string("auth_ldap_user_attribute","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>ldap_search_sub:</TD>
+ <TD>
+ <INPUT name=ldap_search_sub TYPE=text SIZE=1 VALUE="<?=$config->ldap_search_sub?>">
+ <? formerr($err["ldap_search_sub"]); ?>
+ </TD>
+ <TD>
+ <? print_string("auth_ldap_search_sub","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>ldap_bind_dn:</TD>
+ <TD>
+ <INPUT name=ldap_bind_dn TYPE=text SIZE=30 VALUE="<?=$config->ldap_bind_dn?>">
+ <? formerr($err["ldap_bind_dn"]); ?>
+ </TD><TD>
+ <? print_string("auth_ldap_bind_dn","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>ldap_bind_password:</TD>
+ <TD>
+ <INPUT name=ldap_bind_pw TYPE=text SIZE=30 VALUE="<?=$config->ldap_bind_pw?>">
+ <? formerr($err["ldap_bind_pw"]); ?>
+ </TD><TD>
+ <? print_string("auth_ldap_bind_pw","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>auth_instructions:</TD>
+ <TD>
+ <TEXTAREA NAME=auth_instructions COLS=30 ROWS=10 WRAP=virtual><? p($config->auth_instructions) ?></TEXTAREA>
+ </TD>
+ <TD>
+ <? print_string("authinstructions","auth") ?>
+ <? helpbutton("text", get_string("helptext")) ?>
+ </TD>
+</TR>
View
32 auth/nntp/config.html
@@ -0,0 +1,32 @@
+<tr valign="top">
+ <TD ALIGN=RIGHT><P>auth_nntphost:</TD>
+ <TD>
+ <INPUT name="auth_nntphost" TYPE="text" SIZE=30 VALUE="<?=$config->auth_nntphost?>">
+ <? formerr($err["ldap_nntphost"]); ?>
+ </TD>
+ <TD>
+ <? print_string("auth_nntphost","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>auth_nntpport:</TD>
+ <TD>
+ <INPUT name=auth_imapport TYPE=text SIZE=6 VALUE="<?=$config->auth_nntpport?>">
+ <? formerr($err["auth_nntpport"]); ?>
+ </TD>
+ <TD>
+ <? print_string("auth_nntpport","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>auth_instructions:</TD>
+ <TD>
+ <TEXTAREA NAME=auth_instructions COLS=30 ROWS=10 WRAP=virtual><? p($config->auth_instructions) ?></TEXTAREA>
+ </TD>
+ <TD>
+ <? print_string("authinstructions","auth") ?>
+ <? helpbutton("text", get_string("helptext")) ?>
+ </TD>
+</TR>
View
10 auth/nntp/lib.php
@@ -4,10 +4,6 @@
// This code is completely untested so far - IT NEEDS TESTERS!
// Looks like it should work though ...
-$CFG->auth_nntphost = "127.0.0.1"; // Should be IP number
-$CFG->auth_nntpport = "119"; // 119 is most common
-$CFG->auth_instructions = "Use the same username and password as your school news account"; // Instructions
-
function auth_user_login ($username, $password) {
// Returns true if the username and password work
@@ -17,7 +13,11 @@ function auth_user_login ($username, $password) {
$host = "{".$CFG->auth_nntphost.":$CFG->auth_nntpport/nntp}";
- if ($connection = imap_open($host, $username, $password, OP_HALFOPEN)) {
+ error_reporting(0);
+ $connection = imap_open($host, $username, $password, OP_HALFOPEN);
+ error_reporting(7);
+
+ if ($connection) {
imap_close($connection);
return true;
View
1 auth/none/config.html
@@ -0,0 +1 @@
+<!-- No config needed -->
View
45 auth/pop3/config.html
@@ -0,0 +1,45 @@
+<tr valign="top">
+ <TD ALIGN=RIGHT><P>auth_pop3host:</TD>
+ <TD>
+ <INPUT name=auth_pop3host TYPE=text SIZE=30 VALUE="<?=$config->auth_pop3host?>">
+ <? formerr($err["ldap_host_url"]); ?>
+ </TD>
+ <TD>
+ <? print_string("auth_pop3host","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>auth_pop3type:</TD>
+ <TD>
+ <? $pop3types = array("pop3","pop3cert");
+ choose_from_menu($pop3types, "auth_pop3type", $config->auth_pop3type, "");
+ ?>
+ <? formerr($err["auth_pop3type"]); ?>
+ </TD>
+<TD>
+ <? print_string("auth_pop3type","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>auth_pop3port:</TD>
+ <TD>
+ <INPUT name=auth_pop3port TYPE=text SIZE=6 VALUE="<?=$config->auth_pop3port?>">
+ <? formerr($err["auth_pop3port"]); ?>
+ </TD>
+ <TD>
+ <? print_string("auth_pop3port","auth") ?>
+ </TD>
+</TR>
+
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>auth_instructions:</TD>
+ <TD>
+ <TEXTAREA NAME=auth_instructions COLS=30 ROWS=10 WRAP=virtual><? p($config->auth_instructions) ?></TEXTAREA>
+ </TD>
+ <TD>
+ <? print_string("authinstructions","auth") ?>
+ <? helpbutton("text", get_string("helptext")) ?>
+ </TD>
+</TR>
View
12 auth/pop3/lib.php
@@ -4,12 +4,6 @@
// This code is completely untested so far - IT NEEDS TESTERS!
// Looks like it should work though ...
-$CFG->auth_pop3host = "127.0.0.1"; // Should be IP number
-$CFG->auth_pop3type = "pop3"; // pop3, pop3cert
-$CFG->auth_pop3port = "110"; // 110 is most common
-$CFG->auth_instructions = "Use the same username and password as your school email account"; // Instructions
-
-
function auth_user_login ($username, $password) {
// Returns true if the username and password work
// and false if they are wrong or don't exist.
@@ -25,7 +19,11 @@ function auth_user_login ($username, $password) {
break;
}
- if ($connection = imap_open($host, $username, $password, OP_HALFOPEN)) {
+ error_reporting(0);
+ $connection = imap_open($host, $username, $password, OP_HALFOPEN);
+ error_reporting(7);
+
+ if ($connection) {
imap_close($connection);
return true;
View
58 lang/en/auth.php
@@ -0,0 +1,58 @@
+<?PHP
+$string['authintroduction'] = "Choose the authentication module you want to use. The default is 'email' and has the best security. The method 'none' has no checking whatsoever - be careful using it unless you really know what you are doing.";
+$string['showguestlogin'] = "You can hide or show the guest login button on the login page.";
+$string['authenticationoptions'] = "Authentication options";
+$string['authinstructions'] = "Here you can provide instructions for your users, so they know which username and password they should be using. The text you enter here will appear on the login page. If you leave this blank then no instructions will be printed.";
+
+$string['chooseauthmethod'] = "Choose an authentication method: ";
+
+$string['auth_emailtitle'] = "Email-based authentication";
+$string['auth_emaildescription'] = "Email confirmation is the default authentication method. When the user signs up, choosing their own new username and password, a confirmation email is sent to the user's email address. This email contains a secure link to a page where the user can confirm their account.";
+
+$string['auth_nonetitle'] = "No authentication";
+$string['auth_nonedescription'] = "Users can sign in and create valid accounts immediately, with no authentication against an external server and no confirmation via email. Be careful using this option - think of the security and administration problems this could cause.";
+
+$string['auth_ldaptitle'] = "Use an LDAP server";
+$string['auth_ldapdescription'] = "This method provides authentication against an external LDAP server.
+ If the given username and password are valid, Moodle creates a new user
+ entry in its database. This module can read user attributes from LDAP and prefill
+ wanted fields in Moodle. For following logins only the username and
+ password are checked.";
+$string['auth_ldap_bind_dn'] = "If you like to use bind-user to search users, specify it here. Someting like 'cn=ldapuser,ou=public,o=org'";
+$string['auth_ldap_bind_pw'] = "Password for bind-user.";
+$string['auth_ldap_contexts'] = "List of contexts where users are located. Separate different contexts with ';'. Something like 'ou=users,o=org; ou=others,o=org'";
+$string['auth_ldap_host_url'] = "Specify LDAP host in URL-form like 'ldap://ldap.myorg.com/' or 'ldaps//ldap.myorg.com/' ";
+$string['auth_ldap_search_sub'] = "Put value &lt;&gt; 0 if you like to search users from subcontexts.";
+$string['auth_ldap_update_userinfo'] = "Update user information (firstname, lastname, address..) from ldap to Moodle. Look /auth/ldap/attr_mappings.php for mapping information";
+$string['auth_ldap_user_attribute'] = "The attribute used to name/search users. Usually 'cn'.";
+
+$string['auth_imaptitle'] = "Use an IMAP server";
+$string['auth_imapdescription'] = "This method uses an IMAP server to check whether a given username and password is valid.";
+$string['auth_imaphost'] = "The IMAP server address. Use an IP number, not DNS name.";
+$string['auth_imaptype'] = "The IMAP server type. See the help page (above) for more details.";
+$string['auth_imapport'] = "IMAP server port number. Usually this is 143 or 993.";
+
+$string['auth_dbtitle'] = "Use an external database";
+$string['auth_dbdescription'] = "This method uses an external database table to check whether a given username and password is valid.";
+$string['auth_dbhost'] = "The computer hosting the database server.";
+$string['auth_dbtype'] = "The database type (mysql, postgres7, access, oracle etc)";
+$string['auth_dbname'] = "Name of the database itself";
+$string['auth_dbuser'] = "Username with read access to the database";
+$string['auth_dbpass'] = "Password matching the above username";
+$string['auth_dbtable'] = "Name of the table in the database";
+$string['auth_dbfielduser'] = "Name of the field containing usernames";
+$string['auth_dbfieldpass'] = "Name of the field containing passwords";
+$string['auth_db_instructions'] = "Use the same username and password as your school account";
+
+$string['auth_nntptitle'] = "Use an NNTP server";
+$string['auth_nntpdescription'] = "This method uses an NNTP server to check whether a given username and password is valid.";
+$string['auth_nntphost'] = "The NNTP server address. Use an IP number, not DNS name.";
+$string['auth_nntpport'] = "119 is the most common port used";
+
+$string['auth_pop3title'] = "Use a POP3 server";
+$string['auth_pop3description'] = "This method uses a POP3 server to check whether a given username and password is valid.";
+$string['auth_pop3host'] = "The POP3 server address. Use an IP number, not DNS name.";
+$string['auth_pop3type'] = "Server type. If your server uses certificate security, choose pop3cert.";
+$string['auth_pop3port'] = "Server port (110 is the most common)";
+
+?>
View
3 lang/en/moodle.php
@@ -31,6 +31,7 @@
$string['answer'] = "Answer";
$string['assessment'] = "Assessment";
$string['assignteachers'] = "Assign teachers";
+$string['authentication'] = "Authentication";
$string['availablecourses'] = "Available Courses";
$string['cancel'] = "Cancel";
$string['categories'] = "Course categories";
@@ -50,7 +51,6 @@
$string['city'] = "City/town";
$string['closewindow'] = "Close this window";
$string['comparelanguage'] = "Compare and edit current language";
-$string['configauth'] = "Choose the authentication module you want to use. The default is 'email' and has the best security. The method 'none' has no checking whatsoever - be careful using it unless you really know what you are doing.";
$string['configgdversion'] = "Indicate the version of GD that is installed. The version shown by default is the one that has been auto-detected. Don't change this unless you really know what you're doing.";
$string['configerrorlevel'] = "Choose the amount of PHP warnings that you want to be displayed. Normal is usually the best choice.";
$string['confightmleditor'] = "Choose whether or not to allow use of the embedded HTML text editor. Even if you choose allow, this editor will only appear when the user is using a compatible browser (IE 5.5 or later). Users can also choose not to use it.";
@@ -416,6 +416,7 @@
$string['settings'] = "Settings";
$string['shortname'] = "Short name";
$string['shortsitename'] = "Short name for site (eg single word)";
+$string['show'] = "Show";
$string['showalltopics'] = "Show all topics";
$string['showallweeks'] = "Show all weeks";
$string['showlistofcourses'] = "Show list of courses";
View
12 login/index.php
@@ -1,7 +1,6 @@
<?PHP // $Id$
require("../config.php");
-
// Check if the guest user exists. If not, create one.
if (! record_exists("user", "username", "guest")) {
$guest->username = "guest";
@@ -85,10 +84,19 @@
} else {
$focus = "form.username";
}
+
+ if ($CFG->auth == "email" or $CFG->auth == "none" or $CFG->auth_instructions) {
+ $show_instructions = true;
+ } else {
+ $show_instructions = false;
+ }
+ if (!$site = get_site()) {
+ error("No site found!");
+ }
$loginsite = get_string("loginsite");
- print_header($loginsite, $loginsite, get_string("login"), $focus);
+ print_header("$site->fullname: $loginsite", "$loginsite", get_string("login"), $focus);
include("index_form.html");
print_footer();
View
79 login/index_form.html
@@ -2,12 +2,14 @@
<TABLE WIDTH="90%" BORDER="0" CELLSPACING="10" CELLPADDING="5" ALIGN="CENTER">
<TR>
- <TD WIDTH="50%" bgcolor=<?=$THEME->cellheading2?>>
- <P ALIGN="CENTER"><B><FONT SIZE=3><? print_string("returningtosite") ?></FONT></B></P>
- </TD>
- <TD WIDTH="50%" bgcolor=<?=$THEME->cellheading2?>>
- <P ALIGN="CENTER"><B><FONT SIZE=3><? print_string("firsttime") ?></FONT></B></P>
- </TD>
+ <? if ($show_instructions) { ?>
+ <TD WIDTH="50%" bgcolor=<?=$THEME->cellheading2?>>
+ <P ALIGN="CENTER"><B><FONT SIZE=3><? print_string("returningtosite") ?></FONT></B></P>
+ </TD>
+ <TD WIDTH="50%" bgcolor=<?=$THEME->cellheading2?>>
+ <P ALIGN="CENTER"><B><FONT SIZE=3><? print_string("firsttime") ?></FONT></B></P>
+ </TD>
+ <? } ?>
</TR>
<TR>
<TD WIDTH="50%" VALIGN="TOP" bgcolor="<?=$THEME->cellheading?>"> <FONT SIZE=2>
@@ -40,15 +42,17 @@
</FORM>
<FONT SIZE=2>
<BLOCKQUOTE>
- <HR>
- <P ALIGN=CENTER><? print_string("someallowguest") ?>:</P>
- <CENTER>
- <FORM NAME="form2" ACTION="index.php" METHOD=post>
- <INPUT TYPE="hidden" NAME="username" VALUE="guest">
- <INPUT TYPE="hidden" NAME="password" VALUE="guest">
- <INPUT type="submit" NAME="Submit" VALUE="<? print_string("loginguest") ?>">
- </FORM>
- </CENTER>
+ <? if ($CFG->guestloginbutton) { ?>
+ <HR>
+ <P ALIGN=CENTER><? print_string("someallowguest") ?>:</P>
+ <CENTER>
+ <FORM NAME="form2" ACTION="index.php" METHOD=post>
+ <INPUT TYPE="hidden" NAME="username" VALUE="guest">
+ <INPUT TYPE="hidden" NAME="password" VALUE="guest">
+ <INPUT type="submit" NAME="Submit" VALUE="<? print_string("loginguest") ?>">
+ </FORM>
+ </CENTER>
+ <? } ?>
<HR>
<P ALIGN=CENTER><? print_string("forgotten") ?></P>
<CENTER>
@@ -58,26 +62,31 @@
</CENTER>
</BLOCKQUOTE>
</FONT> </TD>
- <TD WIDTH="50%" VALIGN="TOP" bgcolor="<?=$THEME->cellheading?>">
- <FONT SIZE=2>
- <? switch ($CFG->auth) {
- case "email": ?>
- <P><? print_string("loginsteps", "", "signup.php") ?></P>
- </FONT>
- <CENTER>
- <FORM NAME="form4" ACTION="signup.php" METHOD=post>
- <INPUT type="submit" NAME="Submit" VALUE="<? print_string("startsignup") ?>">
- </FORM>
- </CENTER>
- <? break;
- case "none":
- echo "<P>".get_string("loginstepsnone")."</P>";
- break;
- default:
- echo format_text($CFG->auth_instructions);
- }
- ?>
+ <? if ($show_instructions) { ?>
+ <TD WIDTH="50%" VALIGN="TOP" bgcolor="<?=$THEME->cellheading?>">
+ <FONT SIZE=2>
+ <? switch ($CFG->auth) {
+ case "email": ?>
+ <P><? print_string("loginsteps", "", "signup.php") ?></P>
+ </FONT>
+ <CENTER>
+ <FORM NAME="form4" ACTION="signup.php" METHOD=post>
+ <INPUT type="submit" NAME="Submit" VALUE="<? print_string("startsignup") ?>">
+ </FORM>
+ </CENTER>
+ <? break;
+ case "none":
+ echo "<P>".get_string("loginstepsnone")."</P>";
+ break;
+ default:
+ echo "<BLOCKQUOTE>";
+ echo format_text($CFG->auth_instructions);
+ echo "</BLOCKQUOTE>";
+ }
+ ?>
+
+ </TD>
+ <? } ?>
- </TD>
</TR>
</TABLE>

0 comments on commit 35a48c9

Please sign in to comment.
Something went wrong with that request. Please try again.