diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-10-25 15:52:57 -0500 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2011-10-27 15:05:26 +0000 |
commit | 555b13b9aad6d6a174900e89f2ac95c2aa55432b (patch) | |
tree | 647295c4632bded84221b20beda31662cf06bfa2 /install/ui | |
parent | 916d08719b355bec6b8be5e8dd702883037c5eec (diff) | |
download | freeipa.git-555b13b9aad6d6a174900e89f2ac95c2aa55432b.tar.gz freeipa.git-555b13b9aad6d6a174900e89f2ac95c2aa55432b.tar.xz freeipa.git-555b13b9aad6d6a174900e89f2ac95c2aa55432b.zip |
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
Diffstat (limited to 'install/ui')
-rw-r--r-- | install/ui/dialog.js | 1 | ||||
-rw-r--r-- | 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 ff64b37c..73c9b6cc 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 3ff56cd9..69924429 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(IPA.messages.password.password_must_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 || {}; |