[pve-devel] [PATCH manager 1/4] www: parser: add parseTfaType helper

Wolfgang Bumiller w.bumiller at proxmox.com
Thu Apr 11 11:31:59 CEST 2019


The tfa keys can now contain the type as additional
information, so let's parse it out.

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

diff --git a/www/manager6/Parser.js b/www/manager6/Parser.js
index d802b12e..7aea5c73 100644
--- a/www/manager6/Parser.js
+++ b/www/manager6/Parser.js
@@ -561,6 +561,19 @@ Ext.define('PVE.Parser', { statics: {
 	return res;
     },
 
+    parseTfaType: function(value) {
+	var match;
+	if (!value || !value.length) {
+	    return undefined;
+	} else if (value === 'x!oath') {
+	    return 'totp';
+	} else if (match = value.match(/^x!(.+)$/)) {
+	    return match[1];
+	} else {
+	    return 1;
+	}
+    },
+
     parseQemuCpu: function(value) {
 	if (!value) {
 	    return {};
-- 
2.11.0





More information about the pve-devel mailing list