Jump to content
  • 0

Redirect fails aftercaspio login in Wordpress


PeterER8

Question

Hi All!

I am following the "How to Build an Expense Reporting Application With Caspio / Part 4 of 5" tutorial on youtube and trying to make the authentication and redirect work. However, rather than using html pages I am using wordpress and a login page I created for this.

I have created the login page in WP (and other pages as per the tutorial) and successfully embedded the Caspio code. The login screen is there when I go to the login page and I can log in. However, once I log in I would expect the "login Screen" datapage to redirect me to the page in the code. That does not happen. What happens instead is that I am still on the same WP page (the page where the Caspio login is embedded) but now logged in into Caspio. It does not redirect me.

this is the code I am using in the HTML DtaPage

<script>
if("[@authfield:Users_Role]" == "Admin"){
window.location = ""https://mypage.com/Admin/";
}
else if if("[@authfield:Users_Role]" == "Regional Director"){
window.location = "https://mypage.com/dashboard-regional-director/";
}
else if if("[@authfield:Users_Role]" == "Local Director"){
window.location = "https://"https://mypage.com/dashboard-local-director/";
}
else if if("[@authfield:Users_Role]" == "Site Manager"){
window.location = "https://"https://mypage.com/dashboard-site-manager/";
}
else {
window.location = "https://google.com/";
}
</script>

 

What am I missing here?

 

Other than using WP I am following the tutorial to the letter. I even tried to use google as destination for the operator role (last else) with no luck. I also tried to embed the code and to use the caspio plugin - no difference. I am currently using the free Caspio account for testing and learning.

I am using page Builder by siteOrigine and Astra Theme

 

All help highly appreciated!

 

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
3 hours ago, PeterER8 said:

Hi @autonumber

Thanks for the feed back - not that is not it - what you are referring to are my poor redacting skills

this is the actual code - so worst case scenario I should end up on google ... but nothing happens

image.png.72f939e53e9787a14f952ad3aacaa04a.png

you have two ifs on your else ifs

should just be

 

if

else if

else if

else

 

not sure if you need www. as well if you have that on your real link (google should have one)

Link to comment
Share on other sites

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...