Jump to content
  • 0

Redirect user to original url after login?


sadeeque

Question

For users who try to access my pages without being logged in, I have them directed to a login page using the authentication Timeout/redirection option which redirects them to their portal based on their access role. That's really simple and works fine, the problem is that I need to redirect them to the url they were trying to go to after they successfully log in. Is their away to capture their original URL before they're directed by authentication to the login datapage?

Help Plz :)

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
11 hours ago, sadeeque said:

For users who try to access my pages without being logged in, I have them directed to a login page using the authentication Timeout/redirection option which redirects them to their portal based on their access role. That's really simple and works fine, the problem is that I need to redirect them to the url they were trying to go to after they successfully log in. Is their away to capture their original URL before they're directed by authentication to the login datapage?

Help Plz :)

Are you using direct URLs or you're using webpages? I was able to do this on just DataPages, and it needs JavaScript.

Set the Designated Entry Page on Timeout and Redirection to NONE

 

image.png.beed90119603ef52781ee301dcb71918.png

<script>

if(window.location.href != 'URL'){

window.location.href='URL';

}

document.getElementById('cbParamVirtual1').value = document.referrer;

</script>

Basically, on the Authentication that I use, I check if the window.location.href (the URL of the current page) is not equal to your Designated Entry Page, redirect it to your Designated Entry Page.

the last line is putting document.referrer (The URL they got redirected from) and put it in Virtual1

 

Virtual1 should have On Exit enabled:

image.png.cf2ccfd2678a92e11ee2100fc2970c2c.png

 

On your HTML DataPage, check if Virtual1 parameter is blank, if not, redirect, if it is, do some other code you want.

image.png.19e3d9fe439b269770c5ea055a302f5c.png

<script>

if('[@Virtual1]' != ''){

window.location.href='[@Virtual1]';

}

else{

//other code you have

}

</script>

You can hide fields using this or using CSS code.

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