Hi, I'm building "Invite user flow". During this ...
# ask-a-descoper
s
Hi, I'm building "Invite user flow". During this flow, I want the user to set a password and then activate user (Verify token will change status from "Invited" to "Active"). I currently have a setup where I’m using the default password length settings. If I enter a password shorter than 8 characters, the frontend validation correctly prevents the form from being submitted. However, if a user enters a password longer than 64 characters, the user account becomes active, but the password isn’t set. If the user then leaves the page, I end up with an active user account that has no password. And since the token has already been used user will always be redirected to the "Token is invalid" page. What’s the recommended way to handle this? Thanks!
m
@Rahul Rijhwani can you help here ?
👀 1
r
Hi @Serhii The issue you're experiencing stems from the maximum password length validation not being enforced client-side. The password policy allows passwords between 5-64 characters, with a default minimum of 8 To fix this, configure the Maximum Length setting on your New Password input component. In your flow screen: 1. Select your New Password component 2. Go to the Behavior tab 3. Set Maximum Length to 64 This will prevent users from entering passwords longer than 64 characters, ensuring frontend validation catches the issue before submission. Additionally, consider adding a Maximum Length Validation Error Message to provide clear feedback when users exceed the limit. This approach prevents the problematic scenario where the token gets consumed (activating the user) while the password fails to set due to exceeding the maximum length. Check docs: https://docs.descope.com/auth-methods/passwords/settings https://docs.descope.com/flows/screens/inputs
s
Hi @Rahul Rijhwani, thanks for fast answer. Maybe I'm missing something, but "New Password" does not have these settings in the behavior tab. "Input" has, "New Password" not. Am I missing something?
r
Let me check
👀 1
s
Hi @Meir Wahnon @Rahul Rijhwani did you have a chance to check it?
r
We are checking, how you will get max length input option in password.
s
@Rahul Rijhwani thanks!
Hi @Meir Wahnon @Rahul Rijhwani, do you have any updates here?
r
Hi @Serhii Can you export and share your flow json here.
s
@Rahul Rijhwani sent to pm
r
Thanks @Serhii Let me check your flow
Hi @Serhii I check with internal team, When a user clicks on the magic link, their account becomes active. However, if the user leaves the “Set Password” page without completing it, they won’t be able to log in using a password the next time. To handle this scenario, you should add a “Login with Magic Link” option on your login page (alongside the regular password login). This way, if the user returns later, they can request a new magic link, log in through it, and be redirected again to the password setup page.
s
Hi @Rahul Rijhwani, ok, I see, thanks. I'll try to come up with something. And what about this case when the token expired after first attempt and do not allow user to continue the flow?
r
Let me check
Hi @Serhii You are trying to verify the token again. The error of the password pushes the flow back to the screen, and then when you put a new password you run the verify token again. Put the verify token BEFORE the screen like this.
s
Hi, @Rahul Rijhwani In this case chance that a user with status active and without a password is much higher, which I'm trying to avoid. I implemented it like this because of the recommendation from another descoper. Maybe I can add some kind of if / else before verify token?
b
hey @Serhii i have alerted internally that the validation in my opinion should have block the screen, but as a quick work around i would suggest to route the error of the "Update Password" to a copied screen that way you will not run "verify token" again
s
Hi @Bar Saar, ok, I see, thanks! I got the idea. I will still have a case if user leave the page without a password, but I hope you will add frontend validation eventually! By the way, how can I change this error message? It seems it's coming from the backend, and newPassword is not something nice to present to the user. so I would like to change it to just "Password"
b
@Serhii yes you are correct, you can override the error shown using the
errorTransformer
in the front end sdks like shown in the react sdk https://github.com/descope/descope-js/tree/main/packages/sdks/react-sdk#2-provide-flow-id
s
oh, ok I see, thanks!!
👍 1