summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--install/ui/src/freeipa/add.js6
-rw-r--r--install/ui/src/freeipa/host.js60
-rw-r--r--install/ui/test/data/ipa_init.json3
-rw-r--r--ipalib/plugins/internal.py3
4 files changed, 69 insertions, 3 deletions
diff --git a/install/ui/src/freeipa/add.js b/install/ui/src/freeipa/add.js
index 8f24c7733..622108526 100644
--- a/install/ui/src/freeipa/add.js
+++ b/install/ui/src/freeipa/add.js
@@ -84,7 +84,7 @@ IPA.entity_adder_dialog = function(spec) {
that.hide_message();
that.add(
function(data, text_status, xhr) {
- that.added.notify([data], that);
+ that.added.notify([data, 'add_and_add_another'], that);
that.show_message(that.get_success_message(data), 'success');
that.reset();
that.focus_first_element();
@@ -100,7 +100,7 @@ IPA.entity_adder_dialog = function(spec) {
that.hide_message();
that.add(
function(data, text_status, xhr) {
- that.added.notify([data], that);
+ that.added.notify([data, 'add_and_edit'], that);
that.close();
var result = data.result.result;
that.show_edit_page(that.entity, result);
@@ -129,7 +129,7 @@ IPA.entity_adder_dialog = function(spec) {
that.hide_message();
that.add(
function(data, text_status, xhr) {
- that.added.notify([data], that);
+ that.added.notify([data, 'add'], that);
that.close();
that.notify_success(data);
},
diff --git a/install/ui/src/freeipa/host.js b/install/ui/src/freeipa/host.js
index 764e551b4..817e62efc 100644
--- a/install/ui/src/freeipa/host.js
+++ b/install/ui/src/freeipa/host.js
@@ -347,6 +347,12 @@ return {
$type: 'force_host_add_checkbox',
name: 'force',
metadata: '@mc-opt:host_add:force'
+ },
+ {
+ $type: 'checkbox',
+ name: 'random',
+ label: '@i18n:objects.host.generate_otp',
+ title: '@i18n:objects.host.generate_otp'
}
]
}
@@ -529,13 +535,67 @@ IPA.host_adder_dialog = function(spec) {
var that = IPA.entity_adder_dialog(spec);
+ that.init = function() {
+ that.added.attach(that.handle_random_otp);
+ };
+
that.create_content = function() {
that.entity_adder_dialog_create_content();
that.container.addClass('host-adder-dialog');
};
+ that.create_result_dialog = function() {
+ spec = {
+ title: text.get('@i18n:dialogs.result'),
+ sections: [
+ {
+ show_header: false,
+ fields: [
+ {
+ $type: 'text',
+ name: 'randompassword',
+ label: '@i18n:objects.host.generated_otp',
+ read_only: true
+ }
+ ]
+ }
+ ]
+ };
+
+ var dialog = IPA.dialog(spec);
+
+ dialog.create_button({
+ name: 'close',
+ label: text.get('@i18n:buttons.close'),
+ click: function() {
+ dialog.close();
+ }
+ });
+
+
+ return dialog;
+ };
+
+ that.handle_random_otp = function(data, method) {
+ var dialog = that.create_result_dialog();
+ var random_passwd = that.get_field('random').get_value()[0];
+
+ if ((method === 'add' || method === 'add_and_edit') && random_passwd) {
+ var field = dialog.get_field('randompassword');
+ dialog.open();
+ field.load(data);
+ }
+ else if (method === 'add_and_add_another' && random_passwd) {
+ var message = text.get('@i18n:objects.host.generated_otp') +
+ ": " + data.result.result.randompassword;
+ that.show_message(message);
+ }
+ };
+
that.on_error = rpc.create_4304_error_handler(that);
+ that.init();
+
return that;
};
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 1b9b69ff9..6ed7e9824 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -119,6 +119,7 @@
"redirection": "Redirection",
"remove_empty": "Select entries to be removed.",
"remove_title": "Remove ${entity}",
+ "result": "Result",
"show_details": "Show details",
"success": "Success",
"validation_message": "Input form contains invalid or missing values.",
@@ -382,6 +383,8 @@
"enrolled": "Enrolled",
"enrollment": "Enrollment",
"fqdn": "Fully Qualified Host Name",
+ "generate_otp": "Generate OTP",
+ "generated_otp": "Generated OTP",
"keytab": "Kerberos Key",
"keytab_missing": "Kerberos Key Not Present",
"keytab_present": "Kerberos Key Present, Host Provisioned",
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index c28693a46..175063ba1 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -262,6 +262,7 @@ class i18n_messages(Command):
"redirection": _("Redirection"),
"remove_empty": _("Select entries to be removed."),
"remove_title": _("Remove ${entity}"),
+ "result": _("Result"),
"show_details": _("Show details"),
"success": _("Success"),
"validation_title": _("Validation error"),
@@ -527,6 +528,8 @@ class i18n_messages(Command):
"enrolled": _("Enrolled"),
"enrollment": _("Enrollment"),
"fqdn": _("Fully Qualified Host Name"),
+ "generate_otp": _("Generate OTP"),
+ "generated_otp": _("Generated OTP"),
"keytab": _("Kerberos Key"),
"keytab_missing": _("Kerberos Key Not Present"),
"keytab_present": _("Kerberos Key Present, Host Provisioned"),