From c9aef713895c02bb44fe719fcc9a44d6a3898e5f Mon Sep 17 00:00:00 2001 From: polarising-java <57811604+polarising-java@users.noreply.github.com> Date: Tue, 22 Dec 2020 13:26:20 +0000 Subject: [PATCH] feat(ui): disabled login button if security is not enabled (#532) Changed call to auths api to Routes.js. Put result on session storage. Use the storage data in Login Page and Header to enable login. close #507 --- client/src/containers/Header/Header.jsx | 55 +++++++++++--------- client/src/containers/Login/Login.jsx | 26 ++++------ client/src/utils/Routes.js | 67 ++++++++++++++----------- 3 files changed, 81 insertions(+), 67 deletions(-) diff --git a/client/src/containers/Header/Header.jsx b/client/src/containers/Header/Header.jsx index fdf51c53f..694528e34 100644 --- a/client/src/containers/Header/Header.jsx +++ b/client/src/containers/Header/Header.jsx @@ -12,6 +12,7 @@ class Header extends Root { state = { login: sessionStorage.getItem('login'), username: sessionStorage.getItem('user'), + auths: JSON.parse(sessionStorage.getItem('auths')), goBack: true }; @@ -49,9 +50,38 @@ class Header extends Root { }); } + _renderLogin() { + const { login, username, auths } = this.state; + if(auths && auths.loginEnabled) { + return (login === 'false' || !login ? ( + +