[pve-devel] [PATCH v2 manager 4/5] ui: always show otp field

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Apr 2 12:22:07 CEST 2019


But make it optional.

Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 www/manager6/window/LoginWindow.js | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/www/manager6/window/LoginWindow.js b/www/manager6/window/LoginWindow.js
index 3ab5173c..5967c92f 100644
--- a/www/manager6/window/LoginWindow.js
+++ b/www/manager6/window/LoginWindow.js
@@ -63,12 +63,13 @@ Ext.define('PVE.window.LoginWindow', {
 		change: function(f, value) {
 		    var otp_field = this.lookupReference('otpField');
 		    if (f.needOTP(value)) {
-			otp_field.setVisible(true);
-			otp_field.setDisabled(false);
+			otp_field.setConfig('allowBlank', false);
+			otp_field.setEmptyText(gettext('2nd factor'));
 		    } else {
-			otp_field.setVisible(false);
-			otp_field.setDisabled(true);
+			otp_field.setConfig('allowBlank', true);
+			otp_field.setEmptyText(gettext('2nd factor, if required'));
 		    }
+		    otp_field.validate();
 		}
 	    },
 	    'field[name=lang]': {
@@ -154,8 +155,8 @@ Ext.define('PVE.window.LoginWindow', {
 		fieldLabel: gettext('OTP'),
 		name: 'otp',
 		reference: 'otpField',
-		allowBlank: false,
-		hidden: true
+		allowBlank: true,
+		emptyText: gettext('2nd factor, if required')
 	    },
 	    {
 		xtype: 'pveRealmComboBox',
-- 
2.11.0





More information about the pve-devel mailing list