Moodle

Uploading new users: add a flag 'force password change' for CSV

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9
  • Fix Version/s: None
  • Component/s: Administration
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE

Description

Add new field to CSV pointing that newly created users must change their passwords at first login.
It will simply set user preference auth_forcepasswordchange=1 in the database table 'mdl_user_preferences' by calling:

set_user_preference('auth_forcepasswordchange', 1, $user->id);

It is called even now if you 1) leave user password blank and 2) check the flag to create user password (line 534 in admin/uploaduser.php). But it is not exactly what I want - I should wish that password remains the same up to first login of the user.

  1. importusers.txt
    03/Jul/10 10:41 AM
    0.9 kB
    Anthony Borrow
  2. MDL-12986.patch
    03/Jul/10 10:39 AM
    1 kB
    Anthony Borrow

Issue Links

Activity

Hide
Anthony Borrow added a comment -

I'll see if at some point I can get a chance to look at this. Peace - Anthony

Show
Anthony Borrow added a comment - I'll see if at some point I can get a chance to look at this. Peace - Anthony
Hide
Wenxin Lu added a comment -

If I can change 'auth_forcepasswordchange=1' to '0', then it won't be a big problem. But, I cannot find 'auth_forcepasswordchange=1' in able 'mdl_user_preferences'. So, it is still a HUGE burden to admin's workload. eh.....

Show
Wenxin Lu added a comment - If I can change 'auth_forcepasswordchange=1' to '0', then it won't be a big problem. But, I cannot find 'auth_forcepasswordchange=1' in able 'mdl_user_preferences'. So, it is still a HUGE burden to admin's workload. eh.....
Hide
Anthony Borrow added a comment -

Wenxin - Thanks for your comment. If I get a chance this week, I will see if I can come up with a patch. Peace - Anthony

Show
Anthony Borrow added a comment - Wenxin - Thanks for your comment. If I get a chance this week, I will see if I can come up with a patch. Peace - Anthony
Hide
Anthony Borrow added a comment -

I was hoping to have done this sooner, but here is a patch meant mostly as proof of concept. It could use with some better testing in specific situations but it is functional and allows for a forcepasswordchange field in the csv file. If the field is present then it will call set_userpreferences to force the user to change their password. I tested without the field in a csv file and with it and it behaved as expected; however, I would encourage further testing to make sure there are not other scenarios I may have overlooked. Peace - Anthony

Show
Anthony Borrow added a comment - I was hoping to have done this sooner, but here is a patch meant mostly as proof of concept. It could use with some better testing in specific situations but it is functional and allows for a forcepasswordchange field in the csv file. If the field is present then it will call set_userpreferences to force the user to change their password. I tested without the field in a csv file and with it and it behaved as expected; however, I would encourage further testing to make sure there are not other scenarios I may have overlooked. Peace - Anthony
Hide
Anthony Borrow added a comment -

I'm attaching the txt file I used to test with the forcepasswordchange field

Show
Anthony Borrow added a comment - I'm attaching the txt file I used to test with the forcepasswordchange field
Hide
Wen Hao Chuang added a comment -

By the way, from the database (or from Moodle UI), if we check that checkbox for "force password change", is there a way to "know" whether a user actually changed their initial assigned (randomized) password or not?? Thanks!

Show
Wen Hao Chuang added a comment - By the way, from the database (or from Moodle UI), if we check that checkbox for "force password change", is there a way to "know" whether a user actually changed their initial assigned (randomized) password or not?? Thanks!

People

Vote (4)
Watch (4)

Dates

  • Created:
    Updated: