Create a Single Login Page for Multiple User Roles

I attended last weeks new user webinar and a question was raised about creating a single login page for all users so you could just use one URL. I appreciate that this is a variation on the article written by Danielle on the Knowledge Base, however, I thought I’d share my version on this method and hope that it may help someone.


Thanks for the video, Carl. Here’s a question. When the user logs out it puts him on the login page corresponding to the last page he or she was on, not necessarily the “Home” login page. How do you redirect the user to the home login when they logout from a random page?

1 Like

Hey @PeterJurgen - I don’t see this as an issue.

If the user logs out and keeps the browser open, they will simply login to the page they left.
If they log out and the close the browser they would likely use a browser shortcut / bookmark to get them back to the homepage.
There isn’t really a reason, that I can see, to redirect them to the homepage on logout.

I’d imagine, if you need to, it could be done with JavaScript, however, I’m not a coder and have been using this for several years across multiple clients with no issues.

Using separate URL’s for various user roles always caused me more problems. The most common issue I had was when, for example, the warehouse manager changed his PC and didn’t migrate his bookmarks so went to the sales or finance department who gave them their URL.

When he logged in, it showed the pages he had access to, but the screen showed the “you don’t have access to this page” error as the URL was for a page he shouldn’t access.

@CarlHolmes Thanks for sharing.

@PeterJurgen To redirect all other login pages to the home login, you can add this to your Custom JS:

// This redirects all log in pages to the home log in
$(document).on('knack-view-render.any', function(event, view, data) {
  // Replace `view_148` and `#login` with your home login
  if (view.type == 'login' && view.key != 'view_148') {
1 Like

Cool. Thanks

Thanks Carl,
Very helpful, and very simple!

1 Like

@Craig_Anderson - glad that it made sense and hopefully it will be useful for you. :+1: