diff --git a/frontend/src/components/BottomBar.js b/frontend/src/components/BottomBar.js index 736ba1ce..37ad7da9 100644 --- a/frontend/src/components/BottomBar.js +++ b/frontend/src/components/BottomBar.js @@ -122,6 +122,10 @@ class BottomBar extends Component { return url.split('/')[2] } + showProfileButton = () =>{ + return (this.props.avatarLoaded && (this.props.token ? getCookie('robot_token')==this.props.token : true ) && (getCookie('sessionid'))) + } + bottomBarDesktop =()=>{ const { t } = this.props; var hasRewards = this.state.earned_rewards > 0 ? true: false; @@ -132,7 +136,7 @@ bottomBarDesktop =()=>{ -
+
{ this.props.setAppState({buyChecked: false, sellChecked: true, type:0}) && this.getInfo()} + onClick={()=> this.props.setAppState({buyChecked: false, sellChecked: true, type:0}) & this.getInfo()} to={`/book/`} component={LinkRouter} > @@ -180,7 +184,7 @@ bottomBarDesktop =()=>{ this.props.setAppState({buyChecked: true, sellChecked: false, type:1}) && this.getInfo()} + onClick={()=> this.props.setAppState({buyChecked: true, sellChecked: false, type:1}) & this.getInfo()} to={`/book/`} component={LinkRouter} > @@ -323,7 +327,7 @@ bottomBarPhone =()=>{ -
+
@@ -347,7 +351,7 @@ bottomBarPhone =()=>{ this.props.setAppState({buyChecked: false, sellChecked: true, type:0}) && this.getInfo()} + onClick={()=> this.props.setAppState({buyChecked: false, sellChecked: true, type:0}) & this.getInfo()} to={`/book/`} component={LinkRouter} > @@ -361,7 +365,7 @@ bottomBarPhone =()=>{ this.props.setAppState({buyChecked: true, sellChecked: false, type:1}) && this.getInfo()} + onClick={()=> this.props.setAppState({buyChecked: true, sellChecked: false, type:1}) & this.getInfo()} to={`/book/`} component={LinkRouter} > @@ -418,7 +422,6 @@ bottomBarPhone =()=>{ - diff --git a/frontend/src/components/UserGenPage.js b/frontend/src/components/UserGenPage.js index 876d3119..0a0d5508 100644 --- a/frontend/src/components/UserGenPage.js +++ b/frontend/src/components/UserGenPage.js @@ -15,7 +15,7 @@ import { RoboSatsNoTextIcon } from "./Icons"; import { sha256 } from 'js-sha256'; import { genBase62Token, tokenStrength } from "../utils/token"; import { genKey } from "../utils/pgp"; -import { getCookie, writeCookie } from "../utils/cookies"; +import { getCookie, writeCookie, deleteCookie } from "../utils/cookies"; import { saveAsJson } from "../utils/saveFile"; @@ -115,6 +115,11 @@ class UserGenPage extends Component { }; fetch("/api/user", requestOptions) .then((response) => response.json()); + + deleteCookie("sessionid"); + deleteCookie("robot_token"); + deleteCookie("pub_key"); + deleteCookie("enc_priv_key"); } handleClickNewRandomToken=()=>{ diff --git a/frontend/src/utils/cookies.js b/frontend/src/utils/cookies.js index 110e9114..f187e8da 100644 --- a/frontend/src/utils/cookies.js +++ b/frontend/src/utils/cookies.js @@ -15,5 +15,9 @@ export const getCookie = (name) => { }; export const writeCookie = (key,value) => { - document.cookie=key+"="+value; + document.cookie=`${key}=${value};path=/`; } + +export const deleteCookie = (name) => { + document.cookie = `${name}= ; expires = Thu, 01 Jan 1970 00:00:00 GMT` +} \ No newline at end of file diff --git a/robosats/settings.py b/robosats/settings.py index 9b1a2189..9d739747 100644 --- a/robosats/settings.py +++ b/robosats/settings.py @@ -43,6 +43,9 @@ ALLOWED_HOSTS = [ "127.0.0.1", ] +# Allows Session Cookie to be read by Javascript on Client side. +SESSION_COOKIE_HTTPONLY = False + # Application definition INSTALLED_APPS = [