Allow resending of password by email
|Category:||Accounts / authentication|
I started this idea as a comment on this feature:
and decided to move it to it's own 'new feature', so as not to clutter things up and to make it more accessible to others looking for a similar feature.
I previously said:
A necessary addition to the above feature is "resend activation email". I've written account activation systems from scratch for several customers, and there are always users who call/write and say "I didn't get my activation", usually due to spam blocking. Admins need the ability to resend the activation from the pending user record. Otherwise, we have to delete the user and start over, or worse yet, tell the user they're SOL and need to sign up again with a new email address.
Meanwhile, I discovered that adding a single line of code to the UsersController#edit method gave me the functionality I was looking for.
In the "if @user.save" block, add the following.
Mailer.deliver_account_information(@user, params[:password]) if params[:password] and !was_activated
This will send the account information email whenever the admin changes the account password. It allows an admin to resend an account activation by simply resetting the password. It may not suit everyone's needs, but so far it works great for me.