]> git.mjollnir.org Git - moodle.git/commitdiff
Use always only lowercase version of username.
authorpaca70 <paca70>
Mon, 31 Mar 2003 17:05:52 +0000 (17:05 +0000)
committerpaca70 <paca70>
Mon, 31 Mar 2003 17:05:52 +0000 (17:05 +0000)
When using authentication module (ldap, smb, pop etc...) and postgres-database multiple moodle
users were created for usernames like 'Username' 'username' 'userName'

lib/moodlelib.php
login/index.php
login/signup.php
user/edit.php

index 1737dbf970a168380ea1b794cae3f878477db5ac..5856d4bac4daf552ad4c49d1129e7a5c53e16764 100644 (file)
@@ -483,7 +483,9 @@ function get_moodle_cookie() {
 function create_user_record($username, $password) {
 /// Creates a bare-bones user record 
     global $REMOTE_ADDR, $CFG;
-
+    
+    $username = strtolower($username);
+    
     if (function_exists(auth_get_userinfo)) {
         if ($newinfo = auth_get_userinfo($username)) {
             foreach ($newinfo as $key => $value){
index 80e975004fa680b75b01e2a170e67df7ff6579d0..d6f395133ab83e1a187702b8c869ee3462c8bd9d 100644 (file)
@@ -21,7 +21,7 @@
 
 
     if ($frm = data_submitted()) {
-
+        $frm->username = strtolower($frm->username);
         $user = authenticate_user_login($frm->username, $frm->password);
 
         update_login_count();
index f5f9b3285fa4b1e1318e31f8a9174480361dfcb9..a2b793a11a3e64bda2f61e0544f3e2c4dc126be2 100644 (file)
@@ -5,7 +5,7 @@
     require_once("../auth/$CFG->auth/lib.php");
 
        if ($user = data_submitted()) {
-
+        $user->username= strtolower($user->username);
                validate_form($user, $err);
 
                if (count((array)$err) == 0) {
@@ -74,7 +74,7 @@
  *****************************************************************************/
 
 function validate_form($user, &$err) {
-  global $CFG;
+    global $CFG;
        if (empty($user->username))
                $err->username = get_string("missingusername");
 
index 43174b690f80e7be6953d87ea11dacd0aeffc8d5..4f42084c2b582b34f2e1ef388a504173adc51ac7 100644 (file)
@@ -43,7 +43,7 @@
 /// If data submitted, then process and store.
 
        if ($usernew = data_submitted()) {
-
+        $usernew->username = strtolower($usernew->username);
         $usernew->firstname = strip_tags($usernew->firstname);
         $usernew->lastname  = strip_tags($usernew->lastname);