Re: [Freeipa-devel] [PATCH] 742 webui: adjust behavior of bounce url

2014-09-08 Thread Petr Vobornik

On 4.9.2014 01:25, Endi Sukma Dewata wrote:

On 8/21/2014 11:06 AM, Petr Vobornik wrote:

based  on:
http://www.redhat.com/archives/freeipa-devel/2014-August/msg00073.html

- bounce url param was renamed from 'redirect' to 'url'
- support for 'delay' param added

Behavior:

- "Continue to next page" link is shown if 'url' is present
- page is no longer automatically redirected if 'url' is present
- automatic redirect is controlled by 'delay' param - it specifies
   number of seconds until redirection
- info message 'You will be redirected in Xs' is show to notify
   the user that something will happen. It's useful even if delay
   is 0 or negative because redirection might be slow.
- counter is decremented every second
- delay is ignored if parsed as NaN

https://fedorahosted.org/freeipa/ticket/4440


ACK.


Pushed to:
master: 050431c4dd70f024b1644137fb0ad4881ed9e32b
ipa-4-1: c946029ba304efe808106da13e1bfd58135821be




Just one thing, when the delay=0 and the direction happens quickly, the
users might see the confirmation and the redirection messages displayed
briefly on the screen but they cannot read it because it's too quick,
which might leave them wondering what it was.

I think delay=0 is a special case where we want a seamless integration
with 3rd party application. If the password reset is completed
successfully, it should just display the next page in the 3rd party
application. Users shouldn't see a 'redirection' message. To them it's
all one application.



On the other hand it is handy if they delay is not small, e.g., > 2s, 
because user sees that something is happening.


Added to a list of things for discussion with Kyle.
--
Petr Vobornik

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 742 webui: adjust behavior of bounce url

2014-09-03 Thread Endi Sukma Dewata

On 8/21/2014 11:06 AM, Petr Vobornik wrote:

based  on:
http://www.redhat.com/archives/freeipa-devel/2014-August/msg00073.html

- bounce url param was renamed from 'redirect' to 'url'
- support for 'delay' param added

Behavior:

- "Continue to next page" link is shown if 'url' is present
- page is no longer automatically redirected if 'url' is present
- automatic redirect is controlled by 'delay' param - it specifies
   number of seconds until redirection
- info message 'You will be redirected in Xs' is show to notify
   the user that something will happen. It's useful even if delay
   is 0 or negative because redirection might be slow.
- counter is decremented every second
- delay is ignored if parsed as NaN

https://fedorahosted.org/freeipa/ticket/4440


ACK.

Just one thing, when the delay=0 and the direction happens quickly, the 
users might see the confirmation and the redirection messages displayed 
briefly on the screen but they cannot read it because it's too quick, 
which might leave them wondering what it was.


I think delay=0 is a special case where we want a seamless integration 
with 3rd party application. If the password reset is completed 
successfully, it should just display the next page in the 3rd party 
application. Users shouldn't see a 'redirection' message. To them it's 
all one application.


--
Endi S. Dewata

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


[Freeipa-devel] [PATCH] 742 webui: adjust behavior of bounce url

2014-08-21 Thread Petr Vobornik
based  on: 
http://www.redhat.com/archives/freeipa-devel/2014-August/msg00073.html


- bounce url param was renamed from 'redirect' to 'url'
- support for 'delay' param added

Behavior:

- "Continue to next page" link is shown if 'url' is present
- page is no longer automatically redirected if 'url' is present
- automatic redirect is controlled by 'delay' param - it specifies
  number of seconds until redirection
- info message 'You will be redirected in Xs' is show to notify
  the user that something will happen. It's useful even if delay
  is 0 or negative because redirection might be slow.
- counter is decremented every second
- delay is ignored if parsed as NaN

https://fedorahosted.org/freeipa/ticket/4440
--
Petr Vobornik
From 10317eee01d427245be07c1666bf425fbbb596ec Mon Sep 17 00:00:00 2001
From: Petr Vobornik 
Date: Thu, 21 Aug 2014 17:43:39 +0200
Subject: [PATCH] webui: adjust behavior of bounce url

- bounce url param was renamed from 'redirect' to 'url'
- support for 'delay' param added

Behavior:

- "Continue to next page" link is shown if 'url' is present
- page is no longer automatically redirected if 'url' is present
- automatic redirect is controlled by 'delay' param - it specifies
  number of seconds until redirection
- info message 'You will be redirected in Xs' is show to notify
  the user that something will happen. It's useful even if delay
  is 0 or negative because redirection might be slow.
- counter is decremented every second
- delay is ignored if parsed as NaN

https://fedorahosted.org/freeipa/ticket/4440
---
 install/ui/reset_password.html |  3 +++
 install/ui/reset_password.js   | 45 --
 2 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/install/ui/reset_password.html b/install/ui/reset_password.html
index 598fe8f1e9cc440699ccfdd257dd6f569fc4..ec09bbfafc1670df4bdb082c4f337be1ea81213f 100644
--- a/install/ui/reset_password.html
+++ b/install/ui/reset_password.html
@@ -50,6 +50,9 @@
 
 
 
+
+
+
 
 
 
diff --git a/install/ui/reset_password.js b/install/ui/reset_password.js
index 1afc76eba061a7015d1e817e840177fd60e35160..2e0db7db8049aa3edc9bccbfe87b7224d3a68878 100644
--- a/install/ui/reset_password.js
+++ b/install/ui/reset_password.js
@@ -134,6 +134,16 @@ RP.show_error = function(message) {
 $('.alert-success').css('display', 'none');
 };
 
+RP.show_info = function(message) {
+
+$('.alert-info > p').text(message || '');
+if (!message) {
+$('.alert-info').css('display', 'none');
+} else {
+$('.alert-info').css('display', '');
+}
+};
+
 RP.show_success = function(message) {
 
 $('.alert-success > p').text(message);
@@ -158,10 +168,41 @@ RP.parse_uri = function() {
 RP.redirect = function() {
 
 var opts = RP.parse_uri();
-var url = opts['redirect'];
+var url = opts['url'];
+var delay = parseInt(opts['delay'], 10);
+
+var msg_cont = $('.alert-success > p');
+$('.redirect', msg_cont).remove();
+
+// button for manual redirection
 if (url) {
-window.location = url;
+var redir_cont = $('', { 'class': 'redirect' }).
+append(' ').
+append($('', {
+href: url,
+text: 'Continue to next page'
+})).
+appendTo(msg_cont);
+} else {
+return;
 }
+
+if (delay <= 0 || delay > 0) { // NaN check
+RP.redir_url = url;
+RP.redir_delay = delay;
+RP.redir_count_down();
+}
+};
+
+RP.redir_count_down = function() {
+
+RP.show_info("You will be redirected in " + Math.max(RP.redir_delay, 0) + "s");
+if (RP.redir_delay <= 0) {
+window.location = RP.redir_url;
+return;
+}
+window.setTimeout(RP.redir_count_down, 1000);
+RP.redir_delay--;
 };
 
 
-- 
1.9.3

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel