diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2014-07-24 12:56:14 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2014-09-11 17:55:17 +0200 |
commit | 2257f12652eb67ab9ece1f1aa79aa9f784adfb05 (patch) | |
tree | 77b6f87c74faf1b63ff2a09a40e73917f8b8b136 /install/ui/src | |
parent | 15e85db8f873dc133cfd3962d5a58fdb92b17513 (diff) | |
download | freeipa-2257f12652eb67ab9ece1f1aa79aa9f784adfb05.tar.gz freeipa-2257f12652eb67ab9ece1f1aa79aa9f784adfb05.tar.xz freeipa-2257f12652eb67ab9ece1f1aa79aa9f784adfb05.zip |
webui: display fields based on otp token type
- in adder dialog
https://fedorahosted.org/freeipa/ticket/4402
Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
Diffstat (limited to 'install/ui/src')
-rw-r--r-- | install/ui/src/freeipa/otptoken.js | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/install/ui/src/freeipa/otptoken.js b/install/ui/src/freeipa/otptoken.js index 5e395e4a1..e19c7e1d3 100644 --- a/install/ui/src/freeipa/otptoken.js +++ b/install/ui/src/freeipa/otptoken.js @@ -19,6 +19,7 @@ */ define([ + 'dojo/on', './ipa', './jquery', './menu', @@ -30,7 +31,7 @@ define([ './text', './search', './entity'], - function(IPA, $, menu, phases, reg, mod_details, mod_facet, QRCode, text) { + function(on, IPA, $, menu, phases, reg, mod_details, mod_facet, QRCode, text) { /** * OTP tokens module * @class @@ -222,6 +223,9 @@ return { $post_ops: [ otptoken.adder_dialog_qrcode_post_op ], + policies: [ + { $factory: otptoken.adder_policy } + ], fields: [ { $type: 'radio', @@ -293,6 +297,23 @@ return { } };}; +otptoken.adder_policy = function(spec) { + var that = IPA.facet_policy(spec); + that.init = function() { + var type_f = that.container.fields.get_field('type'); + on(type_f, 'value-change', that.on_type_change); + }; + that.on_type_change = function(args) { + var step_f = that.container.fields.get_field('ipatokentotptimestep'); + if (!step_f) return; + var step_w = step_f.widget; + var is_totp = args.value[0] === 'totp'; + step_f.set_enabled(is_totp); + step_w.set_visible(is_totp); + }; + return that; +}; + /** * OTP adder dialog pre-op. * |