Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-42993

Username with spaces no longer valid for LDAP authenticated users

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      • Enable LDAP Auth Plugin in Moodle
        • As admin go to Site Admin -> Plugins -> Authentication -> Manage Authentication
        • Enable LDAP (click the eye)
        • Go to LDAP Settings
          • LDAP URL ldap://localhost
          • Bind Settings:
          • Distinguished Name: cn=admin,dc=moodletest,dc=com
          • Enter in password
          • User lookup settings
          • Contexts: ou=moodleusers,dc=moodletest,dc=com
      • Try to login with 'zaccy d'.
        EXPECTED: Invalid Username Error.
      • Try to login with 'durbertron'
        EXPECTED: Login fine.
      • Run php auth/ldap/cli/sync_users.php
        EXPECTED: Runs fine. No errors.
      • Add

        $CFG->extendedusernamechars = true

        to login/index.html before the username is checked.

      • Try to login with 'zaccy d'.
        EXPECTED: Login fine.
      Show
      Install LDAP Quick but simple to follow guide: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-a-basic-ldap-server-on-an-ubuntu-12-04-vps Or come ask me. I set the following DNS Domain Name: moodletest.com Moodle Users under ou=moodleusers Enable LDAP Auth Plugin in Moodle As admin go to Site Admin -> Plugins -> Authentication -> Manage Authentication Enable LDAP (click the eye) Go to LDAP Settings LDAP URL ldap://localhost Bind Settings: Distinguished Name: cn=admin,dc=moodletest,dc=com Enter in password User lookup settings Contexts: ou=moodleusers,dc=moodletest,dc=com Create following usernames in LDAP under ou=moodleusers. ( http://localhost/phpldapadmin/index.php ) ' zaccy d' - (space zaccy space d) 'durbertron ' - (durbertron space) Try to login with 'zaccy d'. EXPECTED: Invalid Username Error. Try to login with 'durbertron' EXPECTED: Login fine. Run php auth/ldap/cli/sync_users.php EXPECTED: Runs fine. No errors. Add $CFG->extendedusernamechars = true to login/index.html before the username is checked. Try to login with 'zaccy d'. EXPECTED: Login fine.
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-42993-master
    • Story Points:
      13
    • Sprint:
      FRONTEND Sprint 14

      Description

      Using LDAP authentication tied into AD users with spaces in their network logon (sAMAccountName) receive 'The given username contains invalid characters' message when trying to log in to Moodle for the first time. This configuration worked previously on 2.5

      The difference between 2.5 and 2.6 is in lib/moodlelib.php::create_user_record($username, $password, $auth = 'manual') and it used do a database insert for the user record. It now calls the function user_create_user which includes validation.

      To allow the extended user name set you now need to set the following in your Moodle config.php.

      $CFG->extendedusernamechars = true

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                8 Vote for this issue
                Watchers:
                20 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Nov/14