Redirect from the password complete page?
-
Is it possible to automatically redirect users from FusionAuth theme pages by including a
redirect
url param or any other way to convey a destination page?We want to automatically redirect the user somewhere else after the land on the password change complete page. I know you can do this in javascript by modifying the theme and using
window.location
, but was wondering if there was something built in to handle this? -
If you started this request from an oauth grant, they user will be logged in and redirected as if they were finishing the grant (so just make sure wherever they need to end up is in the
Authorized URLs
configuration for the application).If you are ending up on the "password change complete" page, then you didn’t begin this from a grant. In this path, we don’t provide any redirect configuration, but you can either add a URL the user can click on or use JavaScript in the FreeMarker templates (as you mentioned).
-
Hello, I got an issue after updating the password.
I attach the error image
-
You will have to use javascript. All you need is an event listener on the login button, then you check the value of the input field and redirect. This is simple enough to do it with plain javascript, but it's even easier with jQuery. It should be something like this (but I haven't test the code).
$('.orangebutton').click(function () { if ($('input:password').val() == "hello") { window.location.href = "http://stackoverflow.com"; } });
Of course you have to include jquery library and make sure that the dom is loaded.
If you want to simulate someone clicking on a link, use window.location.href
If you want to simulate an HTTP redirect, use window.location.replace
You can use assign() and replace methods also to javascript redirect to other pages like the following:
location.assign("http://example.com");
The difference between replace() method and assign() method(), is that replace() removes the URL of the current document from the document history, means it is not possible to use the “back” button to navigate back to the original document. So Use the assign() method if you want to load a new document, andwant to give the option to navigate back to the original document.
-
Hey FusionAuth fans,
I've just come up with a brilliant idea, why not utilizing theme message? I have working example here. Just a quick run down on what I have done there:
- I am adding a new message key-value pair to my default custom theme called
frontend-app-url
. Implemented in a terraform resource namedcustom-theme
. It is a bit hacky of course. - I am using it in my
change-password-complete.ftl
And this way I worked my way around it
Hopefully this will help you, do not hesitate to give this repo a in GitHub.
- I am adding a new message key-value pair to my default custom theme called