From db5653a7b732b14b24e37701bcb2d86a13d4d8c0 Mon Sep 17 00:00:00 2001 From: Daniel Scalzi Date: Fri, 24 Aug 2018 16:26:50 -0400 Subject: [PATCH] Added additional fix for 'Failed to verify username'. It seemed that login may also randomly fail if the user had a no-dash uuid stored. Corrected this. --- app/assets/js/configmanager.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/assets/js/configmanager.js b/app/assets/js/configmanager.js index 7339209..95289d2 100644 --- a/app/assets/js/configmanager.js +++ b/app/assets/js/configmanager.js @@ -68,7 +68,7 @@ const DEFAULT_CONFIG = { }, commonDirectory: path.join(dataPath, 'common'), instanceDirectory: path.join(dataPath, 'instances'), - clientToken: uuidV4().replace(/-/g, ''), + clientToken: uuidV4(), selectedServer: null, // Resolved selectedAccount: null, authenticationDatabase: {}, @@ -315,6 +315,13 @@ exports.updateAuthAccount = function(uuid, accessToken){ * @returns {Object} The authenticated account object created by this action. */ exports.addAuthAccount = function(uuid, accessToken, username, displayName){ + + if(!/.{8}-.{4}-.{4}-.{4}-.{12}/.test(uuid)){ + const val = Array.from(uuid.match(/(.{8})(.{4})(.{4})(.{4})(.{12})/)) + val.shift() + uuid = val.join('-') + } + config.selectedAccount = uuid config.authenticationDatabase[uuid] = { accessToken,