Nearly every SaaS application needs a way for users to sign up, log in, and have their own private account. In Saasio, the authentication system is powered by a special set of Account Actions that make this process simple and secure. This guide will walk you through the entire setup, from creating your pages to protecting your content.
Part 1: Create the Authentication Pages
First, you need the pages that your users will interact with. Go to the Pages tab and create two new, blank pages:login
: This will be your main login page.signup
: This will be your user registration page.
dashboard
page ready. This will be the first page a user sees after they successfully log in.
Part 2: Building the Sign-Up Form & Workflow
On yoursignup
page, you’ll need a simple form.
UI Setup:
- A Form element.
- Three Input elements inside the form. Name them
name
,email
, andpassword
respectively in their properties. Set the password input’stype
to “Password”. - A Button inside the form with the text “Sign Up”. Set its
type
toSubmit
.
Workflow Setup:
1
1. Select the Form and Open Logic
Select your main Form element and open the Logic tab. We will use the form’s “On Submit” trigger.
2
2. Add the 'Sign up and Login' Action
from the Account Actions category, choose “Sign up and Login with
credentials”.
3
3. Configure the Action
The action needs to know where to get the user’s details. You will map each
parameter to the value from your form’s state:
-
Name: Bind this to the
Data submitted from form
’sname
property. -
Email: Bind this to the
Data submitted from form
’semail
property. -
Password: Bind this to the
Data submitted from form
’spassword
property.
4
4. Add Navigation
After the sign-up action is successful, you want to send the user to their new dashboard.
- Add another action: “Go to page…”.
- Set the destination to your
dashboard
page.
Part 3: Building the Login Form & Workflow
On yourlogin
page, the process is very similar.
UI Setup:
- A Form element.
- Two Input elements inside the form, named
email
andpassword
. - A Submit Button with the text “Login”.
Workflow Setup:
- Select the Form element and open the Logic tab for the “On Submit” trigger.
- Add the “Login with credentials” action from the Account Actions category.
- Bind the
Email
andPassword
parameters to yourData submitted from form
’semail
andpassword
properties. - Add a “Go to page…” action to redirect the user to the
dashboard
on a successful login.
Part 4: Protecting Your Pages
Now that users can log in, you must protect pages like thedashboard
so that only authenticated users can access them. This is done by creating a special workflow that runs the moment a page begins to load, acting as a security checkpoint.
This workflow will check if the user is logged in. If they are not, it will redirect them away before any of the page’s content is shown.
1
1. Select the Page to Protect
In the Pages tab in the left panel, find and select the page you want to protect (e.g.,
dashboard
).2
2. Open the 'On Page Load' Workflow
With the page selected, click the Logic tab in the top navigation bar.
This opens the workflow editor for the page’s default trigger, which is “On
Page Load”. This workflow will be empty by default.
3
3. Add a 'Conditioner' Action
The first and only action we need in this workflow is the “Conditioner”.
This will be our security check.
- From the Custom Logic category, choose the “Conditioner” action.
4
4. Configure the Condition
Now, we need to set up the rule for our check.
- Condition to Check: We want to check if the current user is not authenticated.
- Click into the value field to open the expression editor.
- Select the
Current User
data source. - The
Current User
object has astatus
property. Selectstatus
. - Add an “is equal to” (
=
) operation. - For the second value, choose a static
Text
value ofunauthenticated
.
- Select the
Current User's status = unauthenticated
.5
5. Configure the 'Actions if True'
This is the most important part. The actions in the
Actions if True
branch will only run if the user is not logged in.- Inside the
Actions if True
branch, click ”+ Add Action”. - Add a “Go to page…” action.
- Set the Destination Page to your
login
page.
What about ‘Actions if False’?
You can leave the
Actions if False
branch completely empty. If the condition is false (meaning the user is authenticated), the workflow will simply do nothing and allow the page to load normally for the logged-in user.dashboard
page is secure. When it loads, the workflow runs instantly. If the user is unauthenticated, they are immediately redirected to the login page without ever seeing the protected content. You can replicate this simple one-action workflow on any page you need to protect.
Part 5: Building the Logout Workflow
Finally, you need a way for users to log out. Place a “Logout” button somewhere in your app (like in the navigation bar). This button does not need to be in a form.- Select the “Logout” button and open its Logic tab for the “On Click” trigger.
- Add the “Logout” action from the Account Actions category.
- Add a “Go to page…” action to redirect the user to your
login
or homepage after they have been logged out.