Wednesday, May 23, 2012

Password change not recognized

I tried today for about 1/2 hr to update a user password.  I tried in the native moodle interface and in MySQL Workbench using the update MD5 syntax

UPDATE mdl_user
SET password = MD5('somepassword - that follows my site password policy ')
WHERE username = 'somename';

Both methods seem to be working.  No error message from moodle, and MySQL Workbench displaying a status update that 1 record was updated.

When I tried to log on using the account, I kept getting invalid password or username message.  No errors in moodle log file either.

I tried changing another account and did not see this behavior.

I looked more closely at the two records, the one that worked and the one that did not, to see if something was different between the records.  Then I realized the user records I had imported from my older moodle server had a 0 in the mnethosid column, the accounts I had created had a 1.

I updated the accounts mnethosid column from 0 to 1

 I changed the password again, and logged in successfully.

I did a quick search on mnethosid column but did not turn up anything too interesting.

Moral of the story?

If you want to be able to edit and update a password and still log in using the account, ensure the mnethosid column is set to 1.

No comments:

Post a Comment