FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    How do you reset a user's password upon their first login?

    Scheduled Pinned Locked Moved Solved
    Q&A
    1
    2
    602
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      wesley
      last edited by

      Is it possible to set all users to have the passwordChangeRequired status set to true by default, so they are forced to reset their password upon their first login? Additionally, can we set a default password format as company{username}? For example, a user with the username 1234 would have the default password company1234.

      W 1 Reply Last reply Reply Quote 1
      • W
        wesley @wesley
        last edited by

        Yes, this can be achieved using the FusionAuth API. Here's how you can implement it:

        • Set the default password for each user:
          Use the POST /api/user/change-password endpoint to set the user's password to the desired format, e.g., company1234. Refer to the "Change a User's Password using an email address or username" section of the FusionAuth documentation. This allows you to update a user's password in a single API call without requiring the Forgot Password flow.
        • Require the user to change their password:
          Use the PATCH /api/user/{userId} endpoint to set the passwordChangeRequired field to true. This ensures that the user will be prompted to change their password upon their next login.

        API Documentation for reference:

        • Change a User’s Password
        • Update a User

        Optional Customization:
        To guide users on the login page to use the default password format, you can customize the messaging through FusionAuth Themes:

        • Navigate to Simple Theme > Messages > Default.
        • Add a custom message, such as password=Password is company+username, to inform users of the default password structure.
        1 Reply Last reply Reply Quote 0
        • W wesley has marked this topic as solved on
        • W wesley has marked this topic as solved on
        • First post
          Last post