only when the totp form and the challenge is valid, allow pressing the
apply button, default is disabled, as the 'user_tfa' data binding was
not used anywhere else replace it with something more fitting.
change allowBlank for the challenge
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
in_totp_tab: true,
tfa_required: false,
has_tfa: false,
+ valid: false,
u2f_available: true
},
formulas: {
me.updateQrCode();
}
},
+ 'field': {
+ validitychange: function(field, valid) {
+ var me = this;
+ var viewModel = me.getViewModel();
+ var form = me.lookup('totp_form');
+ var challenge = me.lookup('challenge');
+ viewModel.set('valid', form.isValid() && challenge.isValid());
+ }
+ },
'#': {
show: function() {
var me = this.getView();
xtype: 'textfield',
fieldLabel: gettext('Verification Code'),
labelWidth: 120,
+ allowBlank: false,
reference: 'challenge',
padding: '0 5',
emptyText: gettext('Scan QR code and enter TOTP auth. code to verify')
handler: 'applySettings',
bind: {
hidden: '{!in_totp_tab}',
- disabled: '{!user_tfa}'
+ disabled: '{!valid}'
}
},
{