Use always only lowercase version of username.
When using authentication module (ldap, smb, pop etc...) and postgres-database multiple moodle users were created for usernames like 'Username' 'username' 'userName'
This commit is contained in:
+3
-1
@@ -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){
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
|
||||
|
||||
if ($frm = data_submitted()) {
|
||||
|
||||
$frm->username = strtolower($frm->username);
|
||||
$user = authenticate_user_login($frm->username, $frm->password);
|
||||
|
||||
update_login_count();
|
||||
|
||||
+2
-2
@@ -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");
|
||||
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user