diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2012-10-25 13:42:18 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2013-01-07 10:53:58 +0100 |
commit | e433379c469ab8dba80cb76f906d794e4f61b132 (patch) | |
tree | 54edbc10bf9400744a802c02fa8f8504f8179053 /install/ui/user.js | |
parent | 3df18f5583ff96d505fe9249949bd4493df68172 (diff) | |
download | freeipa-e433379c469ab8dba80cb76f906d794e4f61b132.tar.gz freeipa-e433379c469ab8dba80cb76f906d794e4f61b132.tar.xz freeipa-e433379c469ab8dba80cb76f906d794e4f61b132.zip |
Standardize login password reset, user reset password and host set OTP dialogs
In all dialogs:
* validation notification was standardized
* can be confirmed by enter
User pwd dialog has fixed focus of first element.
https://fedorahosted.org/freeipa/ticket/2884
https://fedorahosted.org/freeipa/ticket/3200
Standartize password reset dialog
Diffstat (limited to 'install/ui/user.js')
-rw-r--r-- | install/ui/user.js | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/install/ui/user.js b/install/ui/user.js index d0f1f5af0..ac51db2ba 100644 --- a/install/ui/user.js +++ b/install/ui/user.js @@ -494,12 +494,18 @@ IPA.user_password_dialog = function(spec) { name: 'password2', label: IPA.messages.password.verify_password, type: 'password', + validators: [IPA.same_password_validator({ + other_field: 'password1' + })], required: true } ] }); var that = IPA.dialog(spec); + + IPA.confirm_mixin().apply(that); + that.success_handler = spec.on_success; that.error_handler = spec.on_error; that.self_service = spec.self_service; //option to force self-service @@ -524,9 +530,12 @@ IPA.user_password_dialog = function(spec) { var self_service = that.is_self_service(); var section = that.widgets.get_widget('input'); + var current_password_f = that.fields.get_field('current_password'); that.dialog_open(); section.set_row_visible('current_password', self_service); + current_password_f.set_required(self_service); + that.focus_first_element(); }; that.create_buttons = function() { @@ -546,37 +555,24 @@ IPA.user_password_dialog = function(spec) { }); }; + that.on_confirm = function() { + that.on_reset_click(); + }; + that.on_reset_click = function() { + if (!that.validate()) return; + var pkey = that.get_pkey(); var self_service = that.is_self_service(); var record = {}; that.save(record); - var current_password; - - if (self_service) { - current_password = record.current_password[0]; - if (!current_password) { - alert(IPA.messages.password.current_password_required); - return; - } - } - + var current_password = self_service ? record.current_password[0] : undefined; var new_password = record.password1[0]; var repeat_password = record.password2[0]; - if (IPA.is_empty(new_password)) { - alert(IPA.messages.password.new_password_required); - return; - } - - if (new_password != repeat_password) { - alert(IPA.messages.password.password_must_match); - return; - } - that.set_password( pkey, current_password, |