Jump to content

Redirect on Authentication Failure


Recommended Posts

Hi, I'm testing a workflow where I'm redirecting a user if the Authentication Fails. It seems that Failure message does not work with scripts, and I'm trying out on the Footer.

 

I can see that this element shows up whenever the error appears

image.png.928947359e6c2c67db7cfc0eddfdaea0.png

I don't know how to implement this with the script, though, are there any ideas?

Link to comment
Share on other sites

Just now, lengleng said:

Hi, I'm testing a workflow where I'm redirecting a user if the Authentication Fails. It seems that Failure message does not work with scripts, and I'm trying out on the Footer.

 

I can see that this element shows up whenever the error appears

image.png.928947359e6c2c67db7cfc0eddfdaea0.png

I don't know how to implement this with the script, though, are there any ideas?

Yeah, you actually can, but, I found that it's better to create your own element with a unique ID so you can reference the ID instead of the class
 

image.png.697baf01ddab11cf2fe8c3b604391c5c.png

 

I have then added an HTML Block in the authentication fields, and NOT the footer because footer and header code gets removed when the Failure Message appears, apparently.

<script type="text/javascript">


document.addEventListener("DataPageReady", function tester(){

if(document.getElementById("errormessage")){

window.location.href = "https://www.google.com";
}


});



</script>

 

Link to comment
Share on other sites

Just now, TellMeWhy said:

Yeah, you actually can, but, I found that it's better to create your own element with a unique ID so you can reference the ID instead of the class
 

image.png.697baf01ddab11cf2fe8c3b604391c5c.png

 

I have then added an HTML Block in the authentication fields, and NOT the footer because footer and header code gets removed when the Failure Message appears, apparently.

<script type="text/javascript">


document.addEventListener("DataPageReady", function tester(){

if(document.getElementById("errormessage")){

window.location.href = "https://www.google.com";
}


});



</script>

 

Thank! I'll try this, but, what if I use auto submit as well? I'm trying to use HTML to Caspio I'm sorry I forgot to include it in the post.

 

Link to comment
Share on other sites

Just now, lengleng said:

Thank! I'll try this, but, what if I use auto submit as well? I'm trying to use HTML to Caspio I'm sorry I forgot to include it in the post.

 

It's pretty easy, just add ELSE on the code and use auto submit 

 

<script type="text/javascript">


document.addEventListener("DataPageReady", function tester(){

if(document.getElementById("errormessage")){

window.location.href = "https://www.google.com";
}
else{

setTimeout('document.forms["caspioform"].submit()',1000); 
}



});

</script>

In my code I removed the display none, but, you can include that since you wouldn't want your users to be seeing that anyway, you can also reduce the 1000 delay to a faster one, but I think that's fast enough and if you have display none, it will be alright.

Link to comment
Share on other sites

5 minutes ago, TellMeWhy said:

It's pretty easy, just add ELSE on the code and use auto submit 

 

<script type="text/javascript">


document.addEventListener("DataPageReady", function tester(){

if(document.getElementById("errormessage")){

window.location.href = "https://www.google.com";
}
else{

setTimeout('document.forms["caspioform"].submit()',1000); 
}



});

</script>

In my code I removed the display none, but, you can include that since you wouldn't want your users to be seeing that anyway, you can also reduce the 1000 delay to a faster one, but I think that's fast enough and if you have display none, it will be alright.

Wow!! Thank you so much!! I'll try this out, I wasn't really keen on implementing this feature, but, since there is a solution, I'll do it now :D

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
Reply to this topic...

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