mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user