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

Cannot delete user if email is over 89 characters long

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Prerequisite:

      1. You need access to DB

      Test steps:

      1. Log in as admin
      2. Navigate to Users > Accounts > Add a new user in Site administration
      3. Give them the following e-mail address (90 characters):

        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@bbbbbbbbbbbbbbbbbbbbb.com

      4. Add some value for all the required fields.
      5. Press Create user
      6. Navigate to Users > Accounts > Browse list of users in Site administration
      7. Note down the ID of the new user
      8. Press Delete for new user
      9. Confirm deletion
      10. Confirm that user is now deleted (and no errors were thrown)
      11. Confirm changes in database (replacing XX with the ID noted in step 6.):

        SELECT username FROM mdl_user WHERE id = XX

      12. You should see the following (timestamp will vary depending on current time):

        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@bbbbbbbbbbbbbbbbbbbbb.co.1578949088

      Show
      Prerequisite: You need access to DB Test steps: Log in as admin Navigate to Users > Accounts > Add a new user in Site administration Give them the following e-mail address (90 characters): aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@bbbbbbbbbbbbbbbbbbbbb.com Add some value for all the required fields. Press Create user Navigate to Users > Accounts > Browse list of users in Site administration Note down the ID of the new user Press Delete for new user Confirm deletion Confirm that user is now deleted (and no errors were thrown) Confirm changes in database (replacing XX with the ID noted in step 6.): SELECT username FROM mdl_user WHERE id = XX You should see the following (timestamp will vary depending on current time): aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@bbbbbbbbbbbbbbbbbbbbb.co.1578949088
    • Workaround:
      Hide

      Shorten the email address to under 90 characters.

      Show
      Shorten the email address to under 90 characters.
    • Affected Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE
    • Pull 3.8 Branch:
    • Pull Master Branch:

      Description

      Trying to delete a user account leads to a database error, if there is 90-100 characters in the user's email address. And the user is not deleted.

      When a user account is deleted, username field gets populated with user's email + dot + timestamp (10 characters). If that string is over 100 characters long, it causes a "Data too long for column 'username'" error. 100 chars is the maximum limit for both username and email fields in Moodle database.

      Steps to reproduce:
      1. Create a new user and fill in an email address with 90 - 100 characters.
      2. Try to delete the user created in step 1.

       

        Attachments

          Activity

            People

            Assignee:
            pholden Paul Holden
            Reporter:
            artonieminen Arto Nieminen
            Peer reviewer:
            Amaia Anabitarte
            Integrator:
            Eloy Lafuente (stronk7)
            Tester:
            Anna Carissa Sadia
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              11/May/20

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 1 hour, 36 minutes
                1d 1h 36m