When user features are enabled you can add a login to any page in your page builder. This is what a login page in the live application looks like when a login is added:
The user must log in with a valid user account before they can access and view the page.
Logins are handled by a special login page and login view. Login pages contain a login view and in this login view there are settings that control how the login works.
You will always be able to identify a login page by the key icon. This will also indicate that all pages and views created under the login are also protected by the login:
Adding Login Pages
Create Login Pages for Multiple User Roles
In order to properly build your app so multiple users with different user roles can login to separate pages, your user login settings must be set to “Choose which pages you want to secure with a login.”
A great example is if you want Employees and Supervisors to have separate login pages in your app.
To access the login settings, click the arrow next to your app title, then click user logins.
Now that the login setting is enabled, you may continue by viewing the video tutorial or by following the step-by-step guide below:
Once you have the proper user login settings enabled, you can add your login page in the pages tab.
Click the "+Add" button located below the pages tab:
This will open a guide or "wizard" (pictured below) explaining how to create the login settings of your choice. For this section we are focused on creating login pages for multiple users so make sure to select:
"Yes, a user must login to access this page" and "limit permissions to specific user roles".
In the role selection box, choose the role for which you want to permit access to this page:
Knack Tip: Knack is a role based user system so it is best practice to assign one role per page and then design the page for that user role. For more on displaying records specific to the logged-in user, view this guide.
Click "continue" and then “select an object” and choose the records you would like to display in the page:
Select the views you would like to add to the page:
Click “continue” to name your page:
Add the title of your user role to your page for quick reference in your pages tab.
Knack Tip: In our example, the new page has been created for the Employee user role. You can continue to customize this page with other views designed for the Employees. When you create a new login page for the Supervisor, using our example, you will customize the page for the Supervisor users.
Create a Login Page for All Users
If you prefer to allow all of your users to view the same pages and data, visit the user login settings and choose “require a single login to access your entire application.” This will create a single login page in your app with a new page menu tab for each page you create.
Once you have applied this setting, you can add pages in the pages tab. As these pages are added, they will be placed into the page menu.
These pages are accessible by all users so there is not an option to created separate login pages:
Add a Login to an Existing Page
First, select the page from the left sidebar, click the settings icon, and choose “Require Login:”
Follow the prompts to choose if you want to limit the login to a specific user role. See section 3.1 for step by step instructions.
After you add the login the page will now have a new parent page, or top level login page (as indicated by the “key” icon). This login page will have settings for controlling the access to that page.
Login and Registration Settings
Each login view can have different settings controlling access and registration. Click directly on the login view to open it in a new window for editing:
Upon opening the login view, you will access various login view settings:
In the user login tab, the User Registration settings control whether registration links will be provided for a new user to sign up and register for a new user account.
Closed- no registration is allowed, only active users will be able to login and view this page.
Open- new users can register and gain immediate access to this page. This will display a “Sign Up” link to a registration form (see below).
Approval- new users can register but can only access the page after you have approved them. You’ll receive an email notifying you of the sign-up, and you can then change their status to active if you approve them (see managing user records).
User role settings control which user roles will be able to login to view this page.
Allow access to all users- Every user can access this page, regardless of which user role they are assigned to.
Note: This is page level access, not all user access for the entire app.
Limit access to specific user roles- Only the selected roles will be able to access this page. All other users will get an error message if they try to login.
This is only available if you’ve created additional user roles (see above). For example, if you have teacher and student users, you may want to allow only teachers to login to some pages, and students to others.
Knack Tip: Read more about security settings available with user logins to help ensure the security of your Live App pages.
If this login page accepts registrations (see above), a registration form view will be added below your login view:
Click directly on the registration view (gray bar) to manage the registration form that the new user will complete to sign-up or request access:
This uses the same structure as the form view. Available fields are optional to add as inputs from the menu to the left. You’ll need to have at least the name, email, and password inputs - these are the minimum fields necessary to add a new user record.
You can also add your own Title/Instructions to a registration form by accessing the special fields tab:
The user will access this registration form from a link below the login in the live application page.