mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Add option to show OTP when adding host
Add option to add host dialog which allows to show generated OTP. This patch also changed the way of informing user about success of adding host but only when the 'Generate OTP' option is checked. There is a new dialog with generated OTP. https://fedorahosted.org/freeipa/ticket/4602 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
This commit is contained in:
parent
f077fab23f
commit
3b37e29ac6
@ -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);
|
||||
},
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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",
|
||||
|
@ -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"),
|
||||
|
Loading…
Reference in New Issue
Block a user