Jump to content
  • 0

Login Redirect on Role


ray

Question

Hello. I am trying to configure a login redirect based on user role per: https://howto.caspio.com/tech-tips-and-articles/common-customizations/create-user-specific-redirect-after-login/

My Admin user role is indicated by a YesNo checkbox in the User table that the authentication is based on.

Here is my javascript from the source code of the footer of a standalone Caspio HTML login page: 

<script>
if("[@authfield:Admin]" == "Yes"){
window.location = "https://[myurl]/a_dashboard.html";
}
else {
window.location = "https://[myurl]/s_dashboard.html";
}
</script>

The Authentication I am using has the redirect "Advanced Option" set to "Same Page" for a successful login. If I enter a redirect here I can only enter one URL. When I try to log in with a User having the Admin role (YesNo checkbox checked), I do not get a redirect to the a_dashboard.html. The login.html web page just refreshes but no longer displays the embedded Caspio login form. Everything works if I remove my javascript redirect code and just let the Advanced Options of the authentication specify a particular page to go to, but this doesn't let me redirect by role...

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...