Loading

Salesforce Platform: Force Password Resets Using Developer Console

Publiseringsdato: Oct 10, 2024
Beskrivelse

Key Definitions:

  • Developer Console (integrated development environment for Apex, Visualforce, and Lightning)
  • setPassword() (Apex method for programmatic password changes)

Use Case:

When using the Developer Console to force password resets to newly created users, using the setPassword method of a System Class, it may redirect to the "Change Your Password" page. Clicking on any text box allows the user to login to the org without setting the security questions.

Important Notes:

 If you have used setPassword() to configure a users' password and they have never set a security question, they will be redirected to the Change Your Password page upon login.

Løsning

Resolution:

This is Working as Designed (WAD) in Salesforce. If you hit enter you are actually hitting the 'cancel' button. The "Save" button doesn't get enabled until the password requirements for the page are met. The password of the user has not been changed. 

If you log out and then log in again, you will see the change password page. This is by design so that the user does not need to change their password or security question at that time. 

Steps to Reproduce: 

1. Login to your org
2. Search for Manage Users | Users | "New User" 
3. Create the User and uncheck the below checkbox :
- Generate new password and notify user immediately
4. Click Save.
5. Open Developer console
6. Open the Execute anonymous window > Write : system.setPassword('005xx0000000XXX', 'passwordText');  i.e System.setPassword(userid, password);
7. Click Execute. 
8. Logout from the org. 
9. Then login to your org using the login.salesforce.com URL.
Note : If you are using the domain name then instead of login.salesforce.com hit your domain name.
10. Put the username and password.  You will be redirected to the change password screen. If you click on any text box and click enter it will log you in. 

Important Notes:

Password reset through Developer Console follows the password complexity set on Password Policies from the user's Profile.

Flere ressurser

See the Help Doc below for details on Developer Console:
Open the Developer Console

Knowledge-artikkelnummer

000387826

 
Laster
Salesforce Help | Article