From 7d1cdb053698926d4ca1587c47f5b6b85b9c98eb Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Wed, 9 Nov 2022 19:42:47 +0100 Subject: [PATCH] Fix #322: German umlauts create mistakes when using them in passwords See https://stackoverflow.com/questions/3626183/javascript-base64-encoding-utf8-string-fails-in-webkit-safari --- webapp/src/utils/authentication.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/src/utils/authentication.ts b/webapp/src/utils/authentication.ts index a4551e7c..6d8276ce 100644 --- a/webapp/src/utils/authentication.ts +++ b/webapp/src/utils/authentication.ts @@ -28,7 +28,7 @@ export function login(username: String, password: String) { method: 'GET', headers: { 'X-Requested-With': 'XMLHttpRequest', - 'Authorization': 'Basic ' + window.btoa(username + ':' + password) + 'Authorization': 'Basic ' + btoa(unescape(encodeURIComponent(username + ':' + password))), }, }; @@ -39,7 +39,7 @@ export function login(username: String, password: String) { if (retVal) { // store user details and basic auth credentials in local storage // to keep user logged in between page refreshes - retVal.authdata = window.btoa(username + ':' + password); + retVal.authdata = btoa(unescape(encodeURIComponent(username + ':' + password))); localStorage.setItem('user', JSON.stringify(retVal)); }