summaryrefslogtreecommitdiffstats
path: root/install/ui/user.js
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2012-06-26 16:19:58 +0200
committerPetr Vobornik <pvoborni@redhat.com>2012-06-29 11:55:53 +0200
commit5b7084aeb587cd06dcfae8ab6fa3b175e6704138 (patch)
tree1d5cda11ef2d773a947d4e2cf815c9513f371807 /install/ui/user.js
parenta6ff85f425d5c38dd89fcd8999e0d62eadb969a1 (diff)
downloadfreeipa-5b7084aeb587cd06dcfae8ab6fa3b175e6704138.tar.gz
freeipa-5b7084aeb587cd06dcfae8ab6fa3b175e6704138.tar.xz
freeipa-5b7084aeb587cd06dcfae8ab6fa3b175e6704138.zip
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
Diffstat (limited to 'install/ui/user.js')
-rw-r--r--install/ui/user.js52
1 files changed, 40 insertions, 12 deletions
diff --git a/install/ui/user.js b/install/ui/user.js
index c9835c9c0..02f6f73e4 100644
--- a/install/ui/user.js
+++ b/install/ui/user.js
@@ -503,9 +503,18 @@ IPA.user_password_dialog = function(spec) {
});
var that = IPA.dialog(spec);
+ that.success_handler = spec.on_success;
+ that.error_handler = spec.on_error;
+ that.self_service = spec.self_service; //option to force self-service
that.get_pkey = function() {
- return IPA.nav.get_state('user-pkey');
+ var pkey;
+ if (that.self_service) {
+ pkey = IPA.whoami.uid[0];
+ } else {
+ pkey = IPA.nav.get_state('user-pkey');
+ }
+ return pkey;
};
that.is_self_service = function() {
@@ -575,17 +584,8 @@ IPA.user_password_dialog = function(spec) {
pkey,
current_password,
new_password,
- function(data, text_status, xhr) {
- alert(IPA.messages.password.password_change_complete);
- that.close();
- // refresh password expiration field
- var facet = IPA.current_entity.get_facet();
- facet.refresh();
- },
- function(xhr, text_status, error_thrown) {
- that.close();
- }
- );
+ that.on_reset_success,
+ that.on_reset_error);
};
that.set_password = function(pkey, current_password, password, on_success, on_error) {
@@ -604,6 +604,34 @@ IPA.user_password_dialog = function(spec) {
command.execute();
};
+ that.on_reset_success = function(data, text_status, xhr) {
+
+ if (that.success_handler) {
+ that.success_handler.call(this, data, text_status, xhr);
+ } else {
+ alert(IPA.messages.password.password_change_complete);
+ that.close();
+
+ // refresh password expiration field
+ var facet = IPA.current_entity.get_facet();
+ facet.refresh();
+
+ if (that.is_self_service()) {
+ var command = IPA.get_whoami_command();
+ command.execute();
+ }
+ }
+ };
+
+ that.on_reset_error = function(xhr, text_status, error_thrown) {
+
+ if (that.error_handler) {
+ that.error_handler.call(this, xhr, text_status, error_thrown);
+ } else {
+ that.close();
+ }
+ };
+
that.create_buttons();
return that;