Re: [Freeipa-devel] [PATCH] 162 Web UI password is going to expire in n days notification

2012-06-29 Thread Petr Vobornik

On 06/28/2012 10:35 PM, Endi Sukma Dewata wrote:


ACK. I have some suggestions below.


Pushed to master.



The reset link probably should be blue to be consistent with the other
links, but maybe it doesn't go well with dark background. Or you can
make the link red (and the whole message clickable) to make sure it's
clear that it's part of the error message, not a permanent part of the
UI like the "Logged in as". Or make the link message more explicit:
"Click here to reset your password."


I tried the blue and indeed it doesn't go well with dark background. I 
will think about the other options.




When you reset the password, a confirmation dialog will appear on top of
the password reset dialog. I think in general we should avoid nesting
dialog. So the password dialog should be closed first then open the
confirmation/error dialog. The password dialog can be reopened if
something goes wrong.


Also same type of dialog is used for validation. And I completely agree 
we should change it. In gnome shell you have to move mouse a lot. Also 
it pauses execution of scripts so page can't update on the background 
when user is reading the message.


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



Btw, the style of the confirmation dialog is different from the other
dialog. Is this intentional?


It's plain JavaScript alert dialog. I looked in git log and it's there 
from the beginning.




One thing I noticed also, when you login with expired password, after
you reset the password it will briefly show the login page again before
showing the UI. I think the login dialog should close immediately once
you click the button.



In my environment it's usually so fast I can't notice it. I have to try 
it on slower machine or in vm to see how annoying it can be.


--
Petr Vobornik

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


Re: [Freeipa-devel] [PATCH] 162 Web UI password is going to expire in n days notification

2012-06-28 Thread Endi Sukma Dewata

On 6/28/2012 8:59 AM, Petr Vobornik wrote:

On 06/27/2012 04:33 PM, Petr Vobornik wrote:

On 06/27/2012 03:54 AM, Endi Sukma Dewata wrote:

On 6/26/2012 9:46 AM, Petr Vobornik wrote:

This is patch is more like a draft.

I'm not sure where to display the 'password is going to expire'
notification.

I was deciding between:
1) red bold text in Web UI header
2) popup dialog after Web UI initialization

I don't like unwanted pop-up dialogs so I used first option.


If we only support 1 short message I'd prefer option #1. Some users
might not want to reset the password immediately, so they need to be
constantly reminded about the password expiration.

If the message is too long, or we want to support multiple messages (not
just for password expiration), we can show a message icon like in the
upper right corner of Fedora desktop. When you click it it will open a
dialog box listing all messages. In this dialog you can delete each
message. The icon will disappear only if there's no message left.


I didn't make a 'password reset link' because it is done in user's
detail page and a link there is right next to this notification.


I'd say the message should include a link, something like this:

Your password will expire in n days. [Reset your password].

The link is important because:

* Without the link the message doesn't tell you what to do or how
to reset the password.
* Users might not realize that the [Logged In As: ] is a link
that can bring them to their profile page.
* Even if they're in the right page, they might not know there's a
reset password link in the action panel.

The [Reset your password] link can open the Password Reset dialog for
the current user, regardless of the current page. To avoid confusion the
dialog probably should be changed to show the username of the user being
updated.

What do you think?



I like it.

I'll add the reset link next to the message. If we encounter more cases
we can moved it to the notification icon functionality.

I found more non-existing options used and also #2876. I'll return to
this ticket when I fix these regression.


Here's an updated version.

It displays the warning with reset link next to it. I slightly modified
user_password_dialog to be usable alone.


ACK. I have some suggestions below.

The reset link probably should be blue to be consistent with the other 
links, but maybe it doesn't go well with dark background. Or you can 
make the link red (and the whole message clickable) to make sure it's 
clear that it's part of the error message, not a permanent part of the 
UI like the "Logged in as". Or make the link message more explicit: 
"Click here to reset your password."


When you reset the password, a confirmation dialog will appear on top of 
the password reset dialog. I think in general we should avoid nesting 
dialog. So the password dialog should be closed first then open the 
confirmation/error dialog. The password dialog can be reopened if 
something goes wrong.


Btw, the style of the confirmation dialog is different from the other 
dialog. Is this intentional?


One thing I noticed also, when you login with expired password, after 
you reset the password it will briefly show the login page again before 
showing the UI. I think the login dialog should close immediately once 
you click the button.


--
Endi S. Dewata


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


Re: [Freeipa-devel] [PATCH] 162 Web UI password is going to expire in n days notification

2012-06-28 Thread Petr Vobornik

On 06/27/2012 04:33 PM, Petr Vobornik wrote:

On 06/27/2012 03:54 AM, Endi Sukma Dewata wrote:

On 6/26/2012 9:46 AM, Petr Vobornik wrote:

This is patch is more like a draft.

I'm not sure where to display the 'password is going to expire'
notification.

I was deciding between:
1) red bold text in Web UI header
2) popup dialog after Web UI initialization

I don't like unwanted pop-up dialogs so I used first option.


If we only support 1 short message I'd prefer option #1. Some users
might not want to reset the password immediately, so they need to be
constantly reminded about the password expiration.

If the message is too long, or we want to support multiple messages (not
just for password expiration), we can show a message icon like in the
upper right corner of Fedora desktop. When you click it it will open a
dialog box listing all messages. In this dialog you can delete each
message. The icon will disappear only if there's no message left.


I didn't make a 'password reset link' because it is done in user's
detail page and a link there is right next to this notification.


I'd say the message should include a link, something like this:

Your password will expire in n days. [Reset your password].

The link is important because:

* Without the link the message doesn't tell you what to do or how
to reset the password.
* Users might not realize that the [Logged In As: ] is a link
that can bring them to their profile page.
* Even if they're in the right page, they might not know there's a
reset password link in the action panel.

The [Reset your password] link can open the Password Reset dialog for
the current user, regardless of the current page. To avoid confusion the
dialog probably should be changed to show the username of the user being
updated.

What do you think?



I like it.

I'll add the reset link next to the message. If we encounter more cases
we can moved it to the notification icon functionality.

I found more non-existing options used and also #2876. I'll return to
this ticket when I fix these regression.


Here's an updated version.

It displays the warning with reset link next to it. I slightly modified 
user_password_dialog to be usable alone.


--
Petr Vobornik
From d85cb42d30b27904cc1afa1ae416c78c1ca6985a Mon Sep 17 00:00:00 2001
From: Petr Vobornik 
Date: Tue, 26 Jun 2012 16:19:58 +0200
Subject: [PATCH] Web UI password is going to expire in n days notification

This patch adds pending password expiration notification support to Web UI. When user's password is going to expire in less or equal than configure days a bold red text 'Your password expires in N days.' and a link 'Reset your password' are shown in Web UI's header (on the left next to 'Logged in as...').

Clicking on 'Reset your password link' opens IPA.user_password_dialog. Successful reset of own password will reload user's information (whoami) and update header (it will most likely hide the warning and link).

https://fedorahosted.org/freeipa/ticket/2625
---
 install/ui/details.js  |2 +-
 install/ui/index.html  |1 +
 install/ui/ipa.css |   12 
 install/ui/ipa.js  |  111 +---
 install/ui/test/data/ipa_init.json |   57 ++-
 install/ui/user.js |   52 +
 install/ui/widget.js   |   25 +
 ipalib/plugins/internal.py |2 +
 8 files changed, 217 insertions(+), 45 deletions(-)

diff --git a/install/ui/details.js b/install/ui/details.js
index 65de284423698bd6f8288fe5f84759d56a47d1b0..618d02f573e38f2573b532440265ff934e91f8c3 100644
--- a/install/ui/details.js
+++ b/install/ui/details.js
@@ -125,7 +125,7 @@ IPA.section_builder = function(spec) {
 section_spec.entity = that.container.entity;
 section_spec.facet = that.container;
 
-if (!section_spec.label && section_spec.name) {
+if (!section_spec.label && section_spec.name && that.container.entity) {
 var obj_messages = IPA.messages.objects[that.container.entity.name];
 section_spec.label = obj_messages[section_spec.name];
 }
diff --git a/install/ui/index.html b/install/ui/index.html
index 653704b7bca323febb7c5874e24b47034f9c898e..33c0923c197d53824d79591488b18dda2ea90ad2 100644
--- a/install/ui/index.html
+++ b/install/ui/index.html
@@ -70,6 +70,7 @@
 
 
 
+
 
 Logged in as: u...@freeipa.org
 
diff --git a/install/ui/ipa.css b/install/ui/ipa.css
index c0cec89a44532e22103474910ae18110597d76ac..dac345ac39c92c30aa6b8c9754eb325c41152c28 100644
--- a/install/ui/ipa.css
+++ b/install/ui/ipa.css
@@ -240,6 +240,18 @@ body {
 border: 0;
 }
 
+/*  Password expiration */
+
+.header-passwordexpires {
+margin-right: 30px;
+color: red;
+font-weight: bold;
+}
+
+.header-passwordexpires a {
+font-weight: bold;
+}
+
 /*  Logged-in 

Re: [Freeipa-devel] [PATCH] 162 Web UI password is going to expire in n days notification

2012-06-27 Thread Petr Vobornik

On 06/27/2012 03:54 AM, Endi Sukma Dewata wrote:

On 6/26/2012 9:46 AM, Petr Vobornik wrote:

This is patch is more like a draft.

I'm not sure where to display the 'password is going to expire'
notification.

I was deciding between:
1) red bold text in Web UI header
2) popup dialog after Web UI initialization

I don't like unwanted pop-up dialogs so I used first option.


If we only support 1 short message I'd prefer option #1. Some users
might not want to reset the password immediately, so they need to be
constantly reminded about the password expiration.

If the message is too long, or we want to support multiple messages (not
just for password expiration), we can show a message icon like in the
upper right corner of Fedora desktop. When you click it it will open a
dialog box listing all messages. In this dialog you can delete each
message. The icon will disappear only if there's no message left.


I didn't make a 'password reset link' because it is done in user's
detail page and a link there is right next to this notification.


I'd say the message should include a link, something like this:

Your password will expire in n days. [Reset your password].

The link is important because:

* Without the link the message doesn't tell you what to do or how
to reset the password.
* Users might not realize that the [Logged In As: ] is a link
that can bring them to their profile page.
* Even if they're in the right page, they might not know there's a
reset password link in the action panel.

The [Reset your password] link can open the Password Reset dialog for
the current user, regardless of the current page. To avoid confusion the
dialog probably should be changed to show the username of the user being
updated.

What do you think?



I like it.

I'll add the reset link next to the message. If we encounter more cases 
we can moved it to the notification icon functionality.


I found more non-existing options used and also #2876. I'll return to 
this ticket when I fix these regression.


--
Petr Vobornik

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


Re: [Freeipa-devel] [PATCH] 162 Web UI password is going to expire in n days notification

2012-06-26 Thread Endi Sukma Dewata

On 6/26/2012 9:46 AM, Petr Vobornik wrote:

This is patch is more like a draft.

I'm not sure where to display the 'password is going to expire'
notification.

I was deciding between:
  1) red bold text in Web UI header
  2) popup dialog after Web UI initialization

I don't like unwanted pop-up dialogs so I used first option.


If we only support 1 short message I'd prefer option #1. Some users 
might not want to reset the password immediately, so they need to be 
constantly reminded about the password expiration.


If the message is too long, or we want to support multiple messages (not 
just for password expiration), we can show a message icon like in the 
upper right corner of Fedora desktop. When you click it it will open a 
dialog box listing all messages. In this dialog you can delete each 
message. The icon will disappear only if there's no message left.



I didn't make a 'password reset link' because it is done in user's
detail page and a link there is right next to this notification.


I'd say the message should include a link, something like this:

  Your password will expire in n days. [Reset your password].

The link is important because:

 * Without the link the message doesn't tell you what to do or how
   to reset the password.
 * Users might not realize that the [Logged In As: ] is a link
   that can bring them to their profile page.
 * Even if they're in the right page, they might not know there's a
   reset password link in the action panel.

The [Reset your password] link can open the Password Reset dialog for 
the current user, regardless of the current page. To avoid confusion the 
dialog probably should be changed to show the username of the user being 
updated.


What do you think?

--
Endi S. Dewata


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


[Freeipa-devel] [PATCH] 162 Web UI password is going to expire in n days notification

2012-06-26 Thread Petr Vobornik

This is patch is more like a draft.

I'm not sure where to display the 'password is going to expire' 
notification.


I was deciding between:
 1) red bold text in Web UI header
 2) popup dialog after Web UI initialization

I don't like unwanted pop-up dialogs so I used first option.

I didn't make a 'password reset link' because it is done in user's 
detail page and a link there is right next to this notification.


Patch description:

This patch adds pending password expiration notification support to Web 
UI. When user's password is going to expire in less or equal than 
configure days a bold red text 'Your password expires in N days' is 
shown in Web UI's header (on the left next to 'Logged in as...').


https://fedorahosted.org/freeipa/ticket/2625
--
Petr Vobornik
From bf386e2bcdb13e8115a0927d24e256ed4b16b4d4 Mon Sep 17 00:00:00 2001
From: Petr Vobornik 
Date: Tue, 26 Jun 2012 16:19:58 +0200
Subject: [PATCH] Web UI password is going to expire in n days notification

This patch adds pending password expiration notification support to Web UI. When user's password is going to expire in less or equal than configure days a bold red text 'Your password expires in N days' is shown in Web UI's header (on the left next to 'Logged in as...').

https://fedorahosted.org/freeipa/ticket/2625
---
 install/ui/index.html  |1 +
 install/ui/ipa.css |8 
 install/ui/ipa.js  |   64 
 install/ui/test/data/ipa_init.json |   56 +++-
 install/ui/widget.js   |   25 +-
 ipalib/plugins/internal.py |1 +
 6 files changed, 131 insertions(+), 24 deletions(-)

diff --git a/install/ui/index.html b/install/ui/index.html
index 653704b7bca323febb7c5874e24b47034f9c898e..33c0923c197d53824d79591488b18dda2ea90ad2 100644
--- a/install/ui/index.html
+++ b/install/ui/index.html
@@ -70,6 +70,7 @@
 
 
 
+
 
 Logged in as: u...@freeipa.org
 
diff --git a/install/ui/ipa.css b/install/ui/ipa.css
index c0cec89a44532e22103474910ae18110597d76ac..d28735e9daf3f6f0995632594eea4728f22978fc 100644
--- a/install/ui/ipa.css
+++ b/install/ui/ipa.css
@@ -240,6 +240,14 @@ body {
 border: 0;
 }
 
+/*  Password expiration */
+
+.header-passwordexpires {
+margin-right: 30px;
+color: red;
+font-weight: bold;
+}
+
 /*  Logged-in As  */
 .header-right {
 float: right;
diff --git a/install/ui/ipa.js b/install/ui/ipa.js
index f0ad01c3215291fe308d8729e66c9202d3a1c248..4723400b3b1f18db34ff6cade295d42f5cd6263f 100644
--- a/install/ui/ipa.js
+++ b/install/ui/ipa.js
@@ -144,6 +144,15 @@ var IPA = function() {
 }
 }));
 
+batch.add_command(IPA.command({
+entity: 'config',
+method: 'show',
+on_success: function(data, text_status, xhr) {
+that.server_config = data.result;
+that.update_password_expiration();
+}
+}));
+
 batch.execute();
 };
 
@@ -459,6 +468,61 @@ IPA.reset_password = function(username, old_password, new_password) {
 return result;
 };
 
+IPA.update_password_expiration = function() {
+
+var now, expires, notify_days, diff, message;
+
+expires = IPA.whoami.krbpasswordexpiration;
+expires = expires ? IPA.parse_utc_date(expires[0]) : null;
+
+notify_days = IPA.server_config.ipapwdexpadvnotify;
+notify_days = notify_days ? notify_days[0] : 0;
+
+now = new Date();
+
+if (expires) {
+
+diff = expires.getTime() - now.getTime();
+diff = Math.floor(diff / 8640);
+
+if (diff <= notify_days) {
+message = IPA.messages.password.expires_in;
+message = message.replace('${days}', diff);
+
+$('.header-passwordexpires').text(message);
+}
+}
+};
+
+IPA.parse_utc_date = function(value) {
+
+if (!value) return null;
+
+// verify length
+if (value.length  != 'mmddHHMMSSZ'.length) {
+return null;
+}
+
+// We only handle GMT
+if (value.charAt(value.length -1) !== 'Z') {
+return null;
+}
+
+var date = new Date();
+
+date.setUTCFullYear(
+value.substring(0, 4),// 
+value.substring(4, 6)-1,  // mm (0-11)
+value.substring(6, 8));   // dd (1-31)
+
+date.setUTCHours(
+value.substring(8, 10),   // HH (0-23)
+value.substring(10, 12),  // MM (0-59)
+value.substring(12, 14)); // SS (0-59)
+
+return date;
+};
+
 /**
  * Call an IPA command over JSON-RPC.
  *
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 6621fe56f1d43f9ac0e2caba30375dbe8416bdea..0dcc4ef172f3128ad72ee107d8cbaa33ed5d53a5 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -439,6 +439,7 @@
 "p