Options to set a password
First of all, the very only way for any user to change their password, is using either of these approaches:
- using
/user/xyz/edit
(with xyz = uid of the user), where there is an option to change your password. But: this can only be done for a logged in user (which assumes that the user succeeded in entering their (old) password).
- using a "one time login URL", as further described below.
Requesting a new password
When you are not logged in, you can navigate to /user/password
within your site (either for D6 or D7). That is where you will find the "request new password".
For a logged in user, in D7, who navigates to /user/password
, you won't get the same "request new password" form however. Instead, you'll get something like so (your.name@yourdomain.com
is the eMail Id to where the request new password eMail will be mailed to):
Password reset instructions will be mailed to your.name@yourdomain.com. You must log out to use the password reset link in the e-mail.
eMail a one time login URL
You may also want to look at what is configured as email templates when new users are created (located at admin/config/people/accounts
). Such as the template for "a new user created by an administrator". By default (in D7) that template looks like so (bold markup added here):
[user:name],
A site administrator at [site:name] has created an account for you.
You may now log in by clicking this link or copying and pasting it to
your browser:
[user:one-time-login-url]
This link can only be used once to log in and will lead you to a page
where you can set your password.
After setting your password, you will be able to log in at
[site:login-url] in the future using:
username: [user:name] password: Your password
So this one time login URL could be used by a new user. And if for some reason that URL doesn't work (anymore), then such user can still user /user/password
.
Variation: any user (such as an admin ...) can use that URL and specify the eMail ID of the new user who has to set a new password (the eMail will arrive at the new user ... if the eMail ID is correct).
Redirect on login when using a one-time login URL
One might consider adding links like /user/password
and/or /user/xyz/edit
(with xyz = uid of the logged in user) anywhere in your site (e.g. somewhere in your theme).
However, I'd use an approach using the Rules module to redirect on login when using a one-time login and password reset. How to actually do so (there are multiple solutions) is detailed in issue # 480584. Personally I'd go for a solution based on what is described in comment #37 of it.
If you're not familiar (enough/yet) with Rules, checkout the 32 (!!!) great, and free, video tutorials Learn the Rules framework, organized in 7 chapters.
Use the Force password change module
Another approach might be to use the Force password change module (available also for D8 now, merci Jaypan!). Here are some details from its project page:
This module allows administrators to force users, by role, individual user, or newly created user, to change their password on their next page load or login, and/or expire their passwords after a period of time.
Features:
- Ability to force all users in a role to change their password.
- Ability to force individual users to reset their password from their profile edit page (user/[UID]/edit).
- Ability to set an expiry on passwords so that if users haven't changed their password within that time period, they will be required to do so.
- Ability to force all new users to change their password on first-time login (site-wide setting for all new users).
Ability for admins to force individual users to change their password on first time login when creating a new user. (Note: If the global setting forcing all new users to reset their password is enabled on the module settings page, this checkbox will not appear as it is redundant).
Listing of stats on the user edit page (user/[UID]/edit) showing:
- Whether the user has a pending forced password change.
- When the user last had their password forced to be changed.
- When the user last changed their password.
Status page for each role showing:
- Password change details by user.
- The last time at which the role was forced to change the password.
- A form to force the password change for all users in that role.
Use admin/config/people/force_password_change
and enable Force password change on first-time login
(can also be configured for selected roles).
/user/pass
. By default reset password link is added below the user login block. You can add this link anywhere you want using menu. – Sumit Madan Sep 11 '15 at 7:40