diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2014-07-23 16:53:56 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2014-07-28 10:36:08 +0200 |
commit | 8288135b5b218cd63d5f5bfba59f6d1f9657af2d (patch) | |
tree | be80e53daf591cd642268a86a6f0b655b03a92e9 | |
parent | ac7df79a43732cead50f83e31220b0bf2d0230f4 (diff) | |
download | freeipa-8288135b5b218cd63d5f5bfba59f6d1f9657af2d.tar.gz freeipa-8288135b5b218cd63d5f5bfba59f6d1f9657af2d.tar.xz freeipa-8288135b5b218cd63d5f5bfba59f6d1f9657af2d.zip |
webui: add bounce url to reset_password.html
reset_password.html now redirects browser to URL specified in 'redirect'
uri component (if present).
The component has to be URI encoded. ie (in browser console):
$ encodeURIComponent('http://pvoborni.fedorapeople.org/doc/#!/guide/Debugging')
-->
"http%3A%2F%2Fpvoborni.fedorapeople.org%2Fdoc%2F%23!%2Fguide%2FDebugging"
-->
https://my.freeipa.server/ipa/ui/reset_password.html?redirect=http%3A%2F%2Fpvoborni.fedorapeople.org%2Fdoc%2F%23!%2Fguide%2FDebugging
https://fedorahosted.org/freeipa/ticket/4440
Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
-rw-r--r-- | install/ui/reset_password.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/install/ui/reset_password.js b/install/ui/reset_password.js index bc0834987..1afc76eba 100644 --- a/install/ui/reset_password.js +++ b/install/ui/reset_password.js @@ -114,6 +114,7 @@ RP.on_submit = function() { } else { RP.reset_form(); RP.show_success("Password reset was successful."); + RP.redirect(); } }; @@ -140,6 +141,29 @@ RP.show_success = function(message) { $('.alert-success').css('display', ''); }; +RP.parse_uri = function() { + var opts = {}; + if (window.location.search.length > 1) { + var couples = window.location.search.substr(1).split("&"); + for (var i=0,l=couples.length; i < l; i++) { + var couple = couples[i].split("="); + var key = decodeURIComponent(couple[0]); + var value = couple.length > 1 ? decodeURIComponent(couple[1]) : ''; + opts[key] = value; + } + } + return opts; +}; + +RP.redirect = function() { + + var opts = RP.parse_uri(); + var url = opts['redirect']; + if (url) { + window.location = url; + } +}; + RP.init = function() { |