From de2bbe328497a32b715b5c8d24a3b0a5e5303de8 Mon Sep 17 00:00:00 2001 From: Alex Szabo Date: Sat, 25 May 2024 12:48:43 +0200 Subject: [PATCH] fix bad login case --- amakit.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/amakit.js b/amakit.js index 665b66d..7e6e42c 100644 --- a/amakit.js +++ b/amakit.js @@ -34,7 +34,11 @@ class Amakit { getCredentials = () => { const credentials = JSON.parse(localStorage.getItem("awsCredentials") || "null"); - return credentials; + if (!credentials || !credentials.accessKeyId || !credentials.secretAccessKey) { + return null; + } else { + return credentials; + } } saveCredentials = (name, accessKeyId, secretAccessKey) => { @@ -74,6 +78,7 @@ class Amakit { this.AWS.config.credentials.get((err) => { if (err) { console.error("Error: ", err); + localStorage.removeItem("awsCredentials"); reject(err); } else { this.isAuthenticated = true;