summaryrefslogtreecommitdiffstats
path: root/install/ui/host.js
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2012-10-25 13:42:18 +0200
committerPetr Vobornik <pvoborni@redhat.com>2013-01-07 10:53:58 +0100
commite433379c469ab8dba80cb76f906d794e4f61b132 (patch)
tree54edbc10bf9400744a802c02fa8f8504f8179053 /install/ui/host.js
parent3df18f5583ff96d505fe9249949bd4493df68172 (diff)
downloadfreeipa.git-e433379c469ab8dba80cb76f906d794e4f61b132.tar.gz
freeipa.git-e433379c469ab8dba80cb76f906d794e4f61b132.tar.xz
freeipa.git-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/host.js')
-rw-r--r--install/ui/host.js38
1 files changed, 21 insertions, 17 deletions
diff --git a/install/ui/host.js b/install/ui/host.js
index 6aff2c50..30086b41 100644
--- a/install/ui/host.js
+++ b/install/ui/host.js
@@ -780,18 +780,26 @@ IPA.host.set_otp_dialog = function(spec) {
{
name: 'password1',
label: IPA.messages.password.new_password,
- type: 'password'
+ type: 'password',
+ required: true
},
{
name: 'password2',
label: IPA.messages.password.verify_password,
- type: 'password'
+ type: 'password',
+ required: true,
+ validators: [IPA.same_password_validator({
+ other_field: 'password1'
+ })]
}
]
}
];
var that = IPA.dialog(spec);
+
+ IPA.confirm_mixin().apply(that);
+
that.facet = spec.facet;
that.set_status = function(status) {
@@ -807,27 +815,23 @@ IPA.host.set_otp_dialog = function(spec) {
}
};
+ that.on_confirm = function() {
+
+ if (!that.validate()) return;
+
+ var new_password = that.fields.get_field('password1').save()[0];
+ that.set_otp(new_password);
+
+ that.close();
+ };
+
that.create_buttons = function() {
that.create_button({
name: 'set_password',
label: IPA.messages.objects.host.password_set_button,
click: function() {
-
- var record = {};
- that.save(record);
-
- var new_password = record.password1[0];
- var repeat_password = record.password2[0];
-
- if (new_password != repeat_password) {
- alert(IPA.messages.password.password_must_match);
- return;
- }
-
- that.set_otp(new_password);
-
- that.close();
+ that.on_confirm();
}
});