Guides & tutorials
Guides & tutorials
In this tutorial we will see how to configure a form that requires users who have not already done so to accept a new privacy policy or other legal terms and conditions.
The most common scenarios in which this use case is commonly used are:
In both cases, users must necessarily accept the regulations. This configuration will help us automate the process of checking which users have already accepted the new regulation and request the acceptance of those who have not yet done so.
Broadly speaking, what the two flows that we are going to configure will do is:
Let’s take a look at how to set it up step by step.
First, go to the form editor and create a new one with two steps. We will configure the first step of the form as follows:
In the step 2 of the form:
Now, let's build the logic for these form steps by connecting a flow to each of them:
This flow will perform a login operation with our API and, based on the information we have about whether or not the user has accepted the terms, it will decide whether to display a second form step to require the acceptance, or simply complete the login flow.
Let's start adding an HTTP Request action to make a login request to our own API.
The settings for this HTTP Request action will vary according to your API but, in our case, they would be:
Include an If/then condition action to check if the login has been successful.
The settings of this If/then condition action are as follows:
Add a Show error message to the false branch to display a custom error message on the form if the credentials are not valid.
As our login endpoint returns metadata as response:
So we will need to include another If/then condition action to the true branch to check if the user has already accepted the conditions. This action will also vary according to your API schema. In some cases, you may need to make an HTTP Request to retrieve further information about the user.
The settings for this If/then condition action are:
Close the true branch by adding a Submit the form action if the user has already accepted the terms and conditions. In this case, we will set a redirection referencing the session token variable that the login HTTP request returns.
The setting for the Submit the form action are:
Add a Store state variable action to the false branch. It is used to store variables, like the claim_url variable, which our login API returns. Then, you can use the stored variables in any flow linked to the same form.
The Store state variable action settings are:
Close the false branch by adding a Jump to a form step action and choose the second step of the form that we have previously created.
This flow will update the provided information from the user and resume the authentication flow.
Add an HTTP Request action providing your update user endpoint.
Again, this action will vary according to your API but, in our case, the settings are:
We will close this flow by adding a Submit the form action with a redirection to the previously stored state variable.
The Submit the form action settings are:
We're done! Now you can adapt this flow to your needs to collect new users' information the next time they log in.
Arengu allows you to build all your user flows connected to your current stack, and avoids coding all the UI, complex integrations, validations or logic from scratch. Try it for free and start building faster and scaling your application needs as they grow.