Moodle
  1. Moodle
  2. MDL-34120

Moodle tries to create a password for user accounts that were not deleted properly using delete_record()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.18, 2.0.9, 2.1.6, 2.2.3, 2.3
    • Fix Version/s: 2.2.4, 2.3.1
    • Component/s: Messages
    • Labels:
      None
    • Testing Instructions:
      Hide

      1/ upload some new users without password
      2/ bork user record by manually setting deleted=1 via db editor
      3/ execute cron
      4/ no email to borked deleted user expected

      Show
      1/ upload some new users without password 2/ bork user record by manually setting deleted=1 via db editor 3/ execute cron 4/ no email to borked deleted user expected
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w27_MDL-34120_m24_delpass
    • Rank:
      42436

      Description

      • When you upload users from a file and tell Moodle to create a password if needed, Moodle creates a empty password field in the database that it fills when the cron.php is next run (at whatever frequency you set it to run)
      • When you delete a user in Moodle, their username is replaced with their email address plus a short random number and their email address is replaced with a long random number that looks a bit like a password hash.

      The problem is:

      I upload users, Then for some reason, I deleted the users. The next time the cron runs, the new password is sent to the long random number, so I am getting this messages:


      The original message was received at Fri, 29 Jun 2012 07:30:05 -0500
      from XXXXXXXXX@localhost

      ----- The following addresses had permanent fatal errors -----
      5afb9bcb73acf95a28aa35dbd9acdbda
      (reason: 550 5.1.1
      <5afb9bcb73acf95a28aa35dbd9acdbda@cloud2.XXX.net>... User unknown)
      (expanded from: 5afb9bcb73acf95a28aa35dbd9acdbda)

      ----- Transcript of session follows -----
      ... while talking to [127.0.0.1]:
      >>> DATA
      <<< 550 5.1.1 <5afb9bcb73acf95a28aa35dbd9acdbda@cloud2.nivel7.net>... User
      unknown
      550 5.1.1 5afb9bcb73acf95a28aa35dbd9acdbda... User unknown
      <<< 503 5.0.0 Need RCPT (recipient)

      – Forwarded part –

      The original message was received at Fri, 29 Jun 2012 07:30:06 -0500
      from XXXXXXXXXXX@localhost

      ----- The following addresses had permanent fatal errors -----
      aa466f29a42582d133bc36c9a227c118
      (reason: 550 5.1.1
      <aa466f29a42582d133bc36c9a227c118@cloud2.nivel7.net>... User unknown)
      (expanded from: aa466f29a42582d133bc36c9a227c118)

      ----- Transcript of session follows -----
      ... while talking to [127.0.0.1]:
      >>> DATA
      <<< 550 5.1.1 <aa466f29a42582d133bc36c9a227c118@cloud2.nivel7.net>... User
      unknown
      550 5.1.1 aa466f29a42582d133bc36c9a227c118... User unknown
      <<< 503 5.0.0 Need RCPT (recipient)

      .............

      Moodle still try to create a password (for any account with no password) even if the user's account was set as deleted

        Activity

        Hide
        Petr Škoda added a comment - - edited

        Users should be deleted only via delete_user() method, setting just deleted flag is wrong, this function removes all user preferences. So I suppose you used either some unmaintained plugin or modified the database directly, right?

        In anycase I am going to add and extra condition into cron to skip these incorrectly deleted users.

        Thanks for the report.

        Show
        Petr Škoda added a comment - - edited Users should be deleted only via delete_user() method, setting just deleted flag is wrong, this function removes all user preferences. So I suppose you used either some unmaintained plugin or modified the database directly, right? In anycase I am going to add and extra condition into cron to skip these incorrectly deleted users. Thanks for the report.
        Hide
        Dan Poltawski added a comment -

        Integrated, thanks (cherry picked to 22 too)

        Show
        Dan Poltawski added a comment - Integrated, thanks (cherry picked to 22 too)
        Hide
        Rossiani Wijaya added a comment -

        This looks great.

        Test passed.

        Show
        Rossiani Wijaya added a comment - This looks great. Test passed.
        Hide
        Sam Hemelryk added a comment -

        Congratulations your code is upstream - gold star for you!

        This issue + 79 others made it in in time for the minor releases.
        Thank you everyone involved for your exuberant efforts.

        Show
        Sam Hemelryk added a comment - Congratulations your code is upstream - gold star for you! This issue + 79 others made it in in time for the minor releases. Thank you everyone involved for your exuberant efforts.

          People

          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: