How to expire a password
clivesj - April 28, 2007 - 21:36
Hello all,
I would like to force my registred members to renew their password after a certain time.
I found this tread: http://drupal.org/node/75549 but the discussion is not finalized.
Anyone knows how to expire the passwords?
thanks,

Write a module
and call it expire_password. You need to decide several things, where to store the expiry date and what options to provide. You have two choices on where to store the expiry, as a profile field or in a separate table shadowing the users table. There are pros and cons for either approach.
Then maybe options such as how to alert the user that pw is about to expire. How much warning, eg if there are 7 days before expiration you might warn every day as the expiry approaches. There may be different expiry periods according to user role. These could be stored in {variable} table.
To trigger the expiry on login would be something like this:
<?phpfunction expire_password_user_pass_validate($form_id, $form_values) {
if ($user->pw_expiry < (time() + $this_role_warning*3600*24)) {
// warn user via form_set_error()
}
}
?>
Without experimenting, I can't be sure the validate will be triggered, you might have to use _form_alter first to add the extra validation function.
I guess how much sense this makes depends on your familiarity with drupal, php and mysql. If you would like to try this and you get stuck, pm me and I will try to help.
www.purpleoar.co.nz/scryptik - Javascript editor with syntax error checking
www.purpleoar.co.nz - Web development, Drupal consultancy
Thanks, i will give it a
Thanks,
i will give it a try.
Has there anything happend yet
Hi Clivesj,
have you started developing this module? I would like to help or start one on my own?!
Cheers,
Ralf
Not Yet
Have to fix some other things,
As soon as I have got results I'll post them here...
regards
If you're still interested,
If you're still interested, I've just created a module that does this. http://drupal.org/project/password_expire
Thanx
Thanks, I will install it and if there's any issue i will report on the project page.