The user adder dialog has been modified to provide optional fields to specify password during user creation.
Ticket #1646 -- Endi S. Dewata
From 0f8b69d72110ce9f92b1b19ae085b00353907e58 Mon Sep 17 00:00:00 2001 From: Endi S. Dewata <edew...@redhat.com> Date: Tue, 25 Oct 2011 15:52:57 -0500 Subject: [PATCH] Added password field in user adder dialog. The user adder dialog has been modified to provide optional fields to specify password during user creation. Ticket #1646 --- install/ui/dialog.js | 1 + install/ui/user.js | 58 +++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/install/ui/dialog.js b/install/ui/dialog.js index ff64b37cc549d7ea9886dc0d58a8f12267ecb839..73c9b6cc30215f59fa3b4be7976c19fb06914106 100644 --- a/install/ui/dialog.js +++ b/install/ui/dialog.js @@ -284,6 +284,7 @@ IPA.dialog = function(spec) { that.dialog_close = that.close; that.dialog_save = that.save; that.dialog_reset = that.reset; + that.dialog_validate = that.validate; return that; }; diff --git a/install/ui/user.js b/install/ui/user.js index 3ff56cd9d2bc3cfe31c1fa88674060bd4d6a9112..bf2be809f723e18a585a38f5900ebea6375dd9d5 100644 --- a/install/ui/user.js +++ b/install/ui/user.js @@ -139,19 +139,67 @@ IPA.entity_factories.user = function() { link: link }). adder_dialog({ - fields: [ + factory: IPA.user_adder_dialog, + sections: [ { - name: 'uid', - required: false + fields: [ + { + name: 'uid', + required: false + }, + 'givenname', + 'sn' + ] }, - 'givenname', - 'sn' + { + fields: [ + { + name: 'userpassword', + label: IPA.messages.password.new_password, + type: 'password' + }, + { + name: 'userpassword2', + label: IPA.messages.password.verify_password, + type: 'password' + } + ] + } ] }); return builder.build(); }; +IPA.user_adder_dialog = function(spec) { + + var that = IPA.entity_adder_dialog(spec); + + that.validate = function() { + var valid = that.dialog_validate(); + + var field1 = that.get_field('userpassword'); + var field2 = that.get_field('userpassword2'); + + var password1 = field1.save()[0]; + var password2 = field2.save()[0]; + + if (password1 !== password2) { + field2.show_error('Passwords do not match'); + valid = false; + } + + return valid; + }; + + that.save = function(record) { + that.dialog_save(record); + delete record.userpassword2; + }; + + return that; +}; + IPA.user_status_widget = function(spec) { spec = spec || {}; -- 1.7.5.1
_______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel