summaryrefslogtreecommitdiffstats
path: root/install/ui
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2013-09-18 17:59:20 +0200
committerPetr Viktorin <pviktori@redhat.com>2014-03-12 17:29:28 +0100
commit05a9c6de2b94459cd5e54addf855bbc76db906ab (patch)
tree1e584b4def87da9c8acd0071737bc43a15f110a0 /install/ui
parent17563108c36f1023876405475714fa60b6637afc (diff)
downloadfreeipa-05a9c6de2b94459cd5e54addf855bbc76db906ab.tar.gz
freeipa-05a9c6de2b94459cd5e54addf855bbc76db906ab.tar.xz
freeipa-05a9c6de2b94459cd5e54addf855bbc76db906ab.zip
Use general password dialog for host OTP
Reviewed-By: Adam Misnyovszki <amisnyov@redhat.com>
Diffstat (limited to 'install/ui')
-rw-r--r--install/ui/src/freeipa/host.js152
1 files changed, 16 insertions, 136 deletions
diff --git a/install/ui/src/freeipa/host.js b/install/ui/src/freeipa/host.js
index 18167f24b..923c82c65 100644
--- a/install/ui/src/freeipa/host.js
+++ b/install/ui/src/freeipa/host.js
@@ -162,17 +162,29 @@ return {
},
'host_unprovision',
{
- $type: 'set_otp',
+ $type: 'password',
name: 'set_otp',
label: '@i18n:objects.host.password_set_title',
- status: 'missing',
+ dialog: {
+ title: '@i18n:objects.host.password_set_title',
+ confirm_button_label: '@i18n:objects.host.password_set_button',
+ password_name: 'userpassword',
+ success_message: '@i18n:objects.host.password_set_success'
+ },
+ enable_cond: ['userpassword_w'],
hide_cond: ['has_password']
},
{
- $type: 'set_otp',
+ $type: 'password',
name: 'reset_otp',
label: '@i18n:objects.host.password_reset_title',
- status: 'present',
+ dialog: {
+ title: '@i18n:objects.host.password_reset_title',
+ confirm_button_label: '@i18n:objects.host.password_reset_button',
+ password_name: 'userpassword',
+ success_message: '@i18n:objects.host.password_set_success'
+ },
+ enable_cond: ['userpassword_w'],
show_cond: ['has_password']
},
'cert_view',
@@ -781,136 +793,6 @@ IPA.host_password_widget = function(spec) {
return that;
};
-IPA.host.set_otp_dialog = function(spec) {
-
- spec = spec || {};
- spec.width = spec.width || 400;
- spec.sections = spec.sections || [
- {
- fields: [
- {
- name: 'password1',
- label: '@i18n:password.new_password',
- $type: 'password',
- required: true
- },
- {
- name: 'password2',
- label: '@i18n:password.verify_password',
- $type: 'password',
- required: true,
- validators: [{
- $type: 'same_password',
- other_field: 'password1'
- }]
- }
- ]
- }
- ];
-
- var that = IPA.dialog(spec);
-
- IPA.confirm_mixin().apply(that);
-
- that.facet = spec.facet;
-
- that.set_status = function(status) {
-
- var button = that.get_button('set_password');
-
- if (status == 'missing') {
- that.title = text.get('@i18n:objects.host.password_set_title');
- button.label = text.get('@i18n:objects.host.password_set_button');
- } else {
- that.title = text.get('@i18n:objects.host.password_reset_title');
- button.label = text.get('@i18n:objects.host.password_reset_button');
- }
- };
-
- 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: '@i18n:objects.host.password_set_button',
- click: function() {
- that.on_confirm();
- }
- });
-
- that.create_button({
- name: 'cancel',
- label: '@i18n:buttons.cancel',
- click: function() {
- that.close();
- }
- });
- };
-
- that.set_otp = function(password) {
- var pkey = that.facet.get_pkeys();
-
- var command = IPA.command({
- entity: that.entity.name,
- method: 'mod',
- args: pkey,
- options: {
- all: true,
- rights: true,
- userpassword: password
- },
- on_success: function(data) {
- that.facet.load(data);
- that.close();
- IPA.notify_success('@i18n:objects.host.password_set_success');
- },
- on_error: function() {
- that.close();
- }
- });
-
- command.execute();
- };
-
- that.create_buttons();
-
- return that;
-};
-
-IPA.host.set_otp_action = function(spec) {
-
- spec = spec || {};
- spec.name = spec.name || 'set_otp';
- spec.label = spec.label || '@i18n:objects.host.password_set_title';
- spec.enable_cond = spec.enable_cond || ['userpassword_w'];
-
- var that = IPA.action(spec);
- that.status = spec.status || 'missing';
-
- that.execute_action = function(facet) {
-
- var dialog = IPA.host.set_otp_dialog({
- entity: facet.entity,
- facet: facet
- });
-
- dialog.set_status(that.status);
-
- dialog.open();
- };
-
- return that;
-};
-
IPA.host.userpassword_acl_evaluator = function(spec) {
spec.name = spec.name || 'userpassword_acl_evaluator';
@@ -956,7 +838,6 @@ IPA.host.certificate_policy = function(spec) {
return that;
};
-
exp.entity_spec = make_spec();
exp.register = function() {
var e = reg.entity;
@@ -977,7 +858,6 @@ exp.register = function() {
w.register('host_password', IPA.host_password_widget);
a.register('host_unprovision', exp.unprovision_action);
- a.register('set_otp', exp.set_otp_action);
};
phases.on('registration', exp.register);