correct privacy policy mount and env

This commit is contained in:
Mateusz Tylka 2023-01-09 09:14:41 +01:00
parent a5841eb830
commit 1863373456
2 changed files with 10 additions and 10 deletions

2
.env
View File

@ -1,3 +1,3 @@
REACT_APP_KC_URL=https://auth-dev.csi.wmi.amu.edu.pl/
REACT_APP_KC_REALM=gonito-dev
REACT_APP_KC_CLIENT_ID=gonito-dev-localhost
REACT_APP_KC_CLIENT_ID=gonito-dev-heroku

View File

@ -25,14 +25,7 @@ const initKeycloak = (onAuthenticatedCallback) => {
.catch(console.error);
};
const doLogin = () => {
const privacyPolicyAccept = localStorage.getItem('privacyPolicy');
if (privacyPolicyAccept !== 'accept') {
window.location.replace(`${ROOT_URL}${POLICY_PRIVACY_PAGE}`);
} else {
_kc.login();
}
};
const doLogin = _kc.login;
const doLogout = () => {
sessionStorage.clear();
@ -41,7 +34,14 @@ const doLogout = () => {
const getToken = () => _kc.token;
const doRegister = _kc.register;
const doRegister = () => {
const privacyPolicyAccept = localStorage.getItem('privacyPolicy');
if (privacyPolicyAccept !== 'accept') {
window.location.replace(`${ROOT_URL}${POLICY_PRIVACY_PAGE}`);
} else {
_kc.register();
}
};
const isLoggedIn = () => !!_kc.token;