From 8288135b5b218cd63d5f5bfba59f6d1f9657af2d Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Wed, 23 Jul 2014 16:53:56 +0200 Subject: [PATCH] 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 --- install/ui/reset_password.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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() {