]> git.mjollnir.org Git - moodle.git/commitdiff
A new option (off by default) will remove restrictions on usernames.
authormoodler <moodler>
Sat, 15 May 2004 07:30:31 +0000 (07:30 +0000)
committermoodler <moodler>
Sat, 15 May 2004 07:30:31 +0000 (07:30 +0000)
  $CFG->extendedusernamechars

config-dist.php
login/signup.php
user/edit.php

index b75c016efa1e5efe8f545685ef3ac951c201633e..b27e92a2f3f1a303288e3f57823a139646c8e45d 100644 (file)
@@ -129,6 +129,9 @@ $CFG->admin = 'admin';
 // 7. OTHER MISCELLANEOUS SETTINGS (ignore these for new installations)
 //=========================================================================
 //
+// These are additional tweaks for which no GUI exists in Moodle yet.
+//
+//
 // Prevent users from updating their profile images
 //      $CFG->disableuserimages = true;  
 //
@@ -151,7 +154,11 @@ $CFG->admin = 'admin';
 //
 // Setting this to true will force a non-guest login to see the user pages 
 // eg the teachers linked from course descriptions or site news
-//      $CFG->forceloginforprofiles
+//      $CFG->forceloginforprofiles = true;
+//
+// Setting this variable will make Moodle allow anything as a username,
+// rather than alphanumerical characters only.
+//      $CFG->extendedusernamechars = true;
 //
 // This setting will put Moodle in Unicode mode.  It's very new and 
 // most likely doesn't work yet.   THIS IS FOR DEVELOPERS ONLY, IT IS
index 8842d6bd43152626f963dab463b0ec688c56bb9e..cec9336f4b3866435cca0bc4bec7a79ffdc6b12d 100644 (file)
@@ -81,6 +81,7 @@
 
 function validate_form($user, &$err) {
     global $CFG;
+
     if (empty($user->username)){
         $err->username = get_string("missingusername");
     } else{
@@ -88,9 +89,11 @@ function validate_form($user, &$err) {
         if (record_exists("user", "username", $user->username)){
             $err->username = get_string("usernameexists");
         } else {
-            $string = eregi_replace("[^(-\.[:alnum:][À-ÖØ-öø-ÿ])]", "", $user->username);
-            if (strcmp($user->username, $string)) {
-                $err->username = get_string("alphanumerical");
+            if (empty($CFG->extendedusernamechars)) {
+                $string = eregi_replace("[^(-\.[:alnum:])]", "", $user->username);
+                if (strcmp($user->username, $string)) {
+                    $err->username = get_string("alphanumerical");
+                }
             }
         }
     }
index 3bbf1691b3b0ffb198c30e3854ae00a51d53f354..16ea08b8ccb38ec09500932adb69527da6c6d01d 100644 (file)
 /// FUNCTIONS ////////////////////
 
 function find_form_errors(&$user, &$usernew, &$err) {
+    global $CFG;
 
     if (isadmin()) {
         if (empty($usernew->username)) {
@@ -211,10 +212,12 @@ function find_form_errors(&$user, &$usernew, &$err) {
                 $err["username"] = get_string("usernameexists");
 
         } else {
-            $string = eregi_replace("[^(-\.[:alnum:][À-ÖØ-öø-ÿ])]", "", $usernew->username);
-
-            if (strcmp($usernew->username, $string)) 
-                $err["username"] = get_string("alphanumerical");
+            if (empty($CFG->extendedusernamechars)) {
+                $string = eregi_replace("[^(-\.[:alnum:])]", "", $usernew->username);
+                if (strcmp($usernew->username, $string)) {
+                    $err["username"] = get_string("alphanumerical");
+                }
+            }
         }
 
         if (empty($usernew->newpassword) and empty($user->password) and is_internal_auth() )