This is an automated email from the ASF dual-hosted git repository.
amagyar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git
The following commit(s) were added to refs/heads/master by this push:
new d8d46d973 KNOX-2810 - Login on Knox UI doesn't work when the password
contains special character (#640)
d8d46d973 is described below
commit d8d46d9737c9038b071a2b39809c18fc92e20f19
Author: Attila Magyar <[email protected]>
AuthorDate: Thu Sep 29 16:34:29 2022 +0200
KNOX-2810 - Login on Knox UI doesn't work when the password contains
special character (#640)
---
.../src/main/resources/applications/knoxauth/app/js/knoxauth.js | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git
a/gateway-applications/src/main/resources/applications/knoxauth/app/js/knoxauth.js
b/gateway-applications/src/main/resources/applications/knoxauth/app/js/knoxauth.js
index f503cde0d..dc2a8bf0c 100644
---
a/gateway-applications/src/main/resources/applications/knoxauth/app/js/knoxauth.js
+++
b/gateway-applications/src/main/resources/applications/knoxauth/app/js/knoxauth.js
@@ -43,6 +43,12 @@ function redirect(redirectUrl) {
}
}
+// btoa skips some of the special characters such as ë
+// https://developer.mozilla.org/en-US/docs/Web/API/btoa
+function unicodeBase64Encode(str) {
+ return btoa(unescape(encodeURIComponent(str)));
+}
+
var keypressed = function(event) {
if (event.keyCode == 13) {
login();
@@ -63,7 +69,7 @@ var login = function() {
//Instantiate HTTP Request
var request = ((window.XMLHttpRequest) ? new XMLHttpRequest() :
new ActiveXObject("Microsoft.XMLHTTP"));
request.open("POST", idpUrl, true);
- request.setRequestHeader("Authorization", "Basic " +
btoa(username + ":" + password));
+ request.setRequestHeader("Authorization", "Basic " +
unicodeBase64Encode(username + ":" + password));
request.send(null);
//Process Response