Jump to content
  • 0

Conditional redirect after logout


imJihyo
 Share

Question

Hi there caspio forum peeps! I'm having a bit of a trouble trying to find a way how I can redirect different users to different pages after they log out. I was thinking of using the same approach with the redirection after login but I'm a little lost. Any other ideas? Thanks!

- Jihyo ♥

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hiyaa @imJihyo! I have already done this before too and you are correct with using the same steps with the user redirect for logins. Here's a step by step process you can refer to:

 1. Copy your logout link and paste it wherever you want it to be located.

 2. Make sure you are passing the parameter (your identifier field like role, user type, etc) so it should be something like this https://mylogoutlinkzkzkz.com?paramname=[@authfield:param] 

3. Just like for logins, create an HTML DataPage and paste the following

<script>
if("[@paramname]" == "User1"){
window.location = "http://www.mysite.com/admin.html";
}
else if ("[@paramname]" == "User2"){
window.location = "http://www.mysite.com/manager.html";
}
else{
window.location = "http://www.mysite.com/employee.html";
}
</script>

NOTES:

  • Please make sure to disable HTML editor before pasting.
  • Do not authenticate the DataPage.
  • Make sure to use the correct parameter name, but there is no need to add the authfield prefix. Just like the one above.
  • Change the condition and location accordingly.

4. Save the DataPage then deploy and get the deployed URL.

5. Go to Authentications, edit, scroll down and expand Advanced settings. Change the logout destination to "Go to new page" then paste your HTML DataPage's deployed URL and pass parameter in query string again. This time, without the authfield prefix as well.

image.thumb.png.c173d0c5985f19ac0fbdcf137d048afb.png

Save then test. 

 

I hope this helps!

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

×
×
  • Create New...