From 4a7a94aa7414a800e51a2b80e9eb19393dd85a2c Mon Sep 17 00:00:00 2001 From: ayusharma Date: Thu, 26 Jul 2018 17:11:28 +0200 Subject: [PATCH] feat: adds base64 support in webui token (#840) --- package.json | 1 + src/webui/components/Header/index.js | 3 ++- yarn.lock | Bin 348484 -> 348633 bytes 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 9f9f8ffba..f65130f8b 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "global": "4.3.2", "handlebars": "4.0.11", "http-errors": "1.6.2", + "js-base64": "2.4.8", "js-string-escape": "1.0.1", "js-yaml": "3.11.0", "jsonwebtoken": "8.2.1", diff --git a/src/webui/components/Header/index.js b/src/webui/components/Header/index.js index 3bdecc330..9bcdcabcd 100644 --- a/src/webui/components/Header/index.js +++ b/src/webui/components/Header/index.js @@ -4,6 +4,7 @@ import isString from 'lodash/isString'; import isNumber from 'lodash/isNumber'; import capitalize from 'lodash/capitalize'; import {Link} from 'react-router-dom'; +import {Base64} from 'js-base64'; import API from '../../utils/api'; import storage from '../../utils/storage'; @@ -108,7 +109,7 @@ export default class Header extends React.Component { } try { - payload = JSON.parse(atob(payload)); + payload = JSON.parse(Base64.decode(payload)); } catch (err) { console.error('Invalid token:', err, token); // eslint-disable-line return false; diff --git a/yarn.lock b/yarn.lock index 26a0550b546912ff4b3c8b230cc6a51d9648c021..6b70bbd4ca5f0a68ca70c09b89b70cdb200978e9 100644 GIT binary patch delta 89 zcmX@INc84n(S{brElg*=Pv6(XA~s!6ok?rD{0}B6Jqx{(^eSaj^F+%eLt_IA3yU;M sQ!@)=lf*<5gJjbrLo?H)L{rOTb5n~n17qX%{ok2@n0fpD?<}p60DLqbSO5S3 delta 27 hcmcb)SoFvu(S{brElg*=wA_2W94K)A&