mirror of
https://github.com/RoboSats/robosats.git
synced 2025-07-31 15:51:48 +00:00
Delete and reload cookies on avatar login
This commit is contained in:
@ -122,6 +122,10 @@ class BottomBar extends Component {
|
|||||||
return url.split('/')[2]
|
return url.split('/')[2]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showProfileButton = () =>{
|
||||||
|
return (this.props.avatarLoaded && (this.props.token ? getCookie('robot_token')==this.props.token : true ) && (getCookie('sessionid')))
|
||||||
|
}
|
||||||
|
|
||||||
bottomBarDesktop =()=>{
|
bottomBarDesktop =()=>{
|
||||||
const { t } = this.props;
|
const { t } = this.props;
|
||||||
var hasRewards = this.state.earned_rewards > 0 ? true: false;
|
var hasRewards = this.state.earned_rewards > 0 ? true: false;
|
||||||
@ -132,7 +136,7 @@ bottomBarDesktop =()=>{
|
|||||||
<Grid container>
|
<Grid container>
|
||||||
|
|
||||||
<Grid item xs={1.9}>
|
<Grid item xs={1.9}>
|
||||||
<div style={{display: this.props.avatarLoaded && (this.props.token ? getCookie('robot_token')==this.props.token : true ) ? '':'none'}}>
|
<div style={{display: this.showProfileButton() ? '':'none'}}>
|
||||||
<ListItemButton onClick={this.handleClickOpenProfile} >
|
<ListItemButton onClick={this.handleClickOpenProfile} >
|
||||||
<Tooltip
|
<Tooltip
|
||||||
open={hasRewards || hasOrder}
|
open={hasRewards || hasOrder}
|
||||||
@ -161,7 +165,7 @@ bottomBarDesktop =()=>{
|
|||||||
<ListItemIcon size="small">
|
<ListItemIcon size="small">
|
||||||
<IconButton
|
<IconButton
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={()=> 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/`}
|
to={`/book/`}
|
||||||
component={LinkRouter} >
|
component={LinkRouter} >
|
||||||
<InventoryIcon/>
|
<InventoryIcon/>
|
||||||
@ -180,7 +184,7 @@ bottomBarDesktop =()=>{
|
|||||||
<ListItemIcon size="small">
|
<ListItemIcon size="small">
|
||||||
<IconButton
|
<IconButton
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={()=> 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/`}
|
to={`/book/`}
|
||||||
component={LinkRouter} >
|
component={LinkRouter} >
|
||||||
<SellIcon/>
|
<SellIcon/>
|
||||||
@ -323,7 +327,7 @@ bottomBarPhone =()=>{
|
|||||||
<Grid container>
|
<Grid container>
|
||||||
|
|
||||||
<Grid item xs={1.6}>
|
<Grid item xs={1.6}>
|
||||||
<div style={{display: this.props.avatarLoaded && (this.props.token ? getCookie('robot_token')==this.props.token : true ) ? '':'none'}}>
|
<div style={{display: this.showProfileButton() ? '':'none'}}>
|
||||||
<Tooltip open={hasRewards || hasOrder}
|
<Tooltip open={hasRewards || hasOrder}
|
||||||
title={(hasRewards ? t("You can claim satoshis!")+" ": "" )+
|
title={(hasRewards ? t("You can claim satoshis!")+" ": "" )+
|
||||||
(hasOrder ? t("You have an active order"):"")}>
|
(hasOrder ? t("You have an active order"):"")}>
|
||||||
@ -347,7 +351,7 @@ bottomBarPhone =()=>{
|
|||||||
<Tooltip enterTouchDelay={300} title={t("Number of public BUY orders")}>
|
<Tooltip enterTouchDelay={300} title={t("Number of public BUY orders")}>
|
||||||
<IconButton
|
<IconButton
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={()=> 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/`}
|
to={`/book/`}
|
||||||
component={LinkRouter} >
|
component={LinkRouter} >
|
||||||
<Badge badgeContent={this.state.num_public_buy_orders} color="action">
|
<Badge badgeContent={this.state.num_public_buy_orders} color="action">
|
||||||
@ -361,7 +365,7 @@ bottomBarPhone =()=>{
|
|||||||
<Tooltip enterTouchDelay={300} title={t("Number of public SELL orders")}>
|
<Tooltip enterTouchDelay={300} title={t("Number of public SELL orders")}>
|
||||||
<IconButton
|
<IconButton
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={()=> 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/`}
|
to={`/book/`}
|
||||||
component={LinkRouter} >
|
component={LinkRouter} >
|
||||||
<Badge badgeContent={this.state.num_public_sell_orders} color="action">
|
<Badge badgeContent={this.state.num_public_sell_orders} color="action">
|
||||||
@ -418,7 +422,6 @@ bottomBarPhone =()=>{
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
@ -15,7 +15,7 @@ import { RoboSatsNoTextIcon } from "./Icons";
|
|||||||
import { sha256 } from 'js-sha256';
|
import { sha256 } from 'js-sha256';
|
||||||
import { genBase62Token, tokenStrength } from "../utils/token";
|
import { genBase62Token, tokenStrength } from "../utils/token";
|
||||||
import { genKey } from "../utils/pgp";
|
import { genKey } from "../utils/pgp";
|
||||||
import { getCookie, writeCookie } from "../utils/cookies";
|
import { getCookie, writeCookie, deleteCookie } from "../utils/cookies";
|
||||||
import { saveAsJson } from "../utils/saveFile";
|
import { saveAsJson } from "../utils/saveFile";
|
||||||
|
|
||||||
|
|
||||||
@ -115,6 +115,11 @@ class UserGenPage extends Component {
|
|||||||
};
|
};
|
||||||
fetch("/api/user", requestOptions)
|
fetch("/api/user", requestOptions)
|
||||||
.then((response) => response.json());
|
.then((response) => response.json());
|
||||||
|
|
||||||
|
deleteCookie("sessionid");
|
||||||
|
deleteCookie("robot_token");
|
||||||
|
deleteCookie("pub_key");
|
||||||
|
deleteCookie("enc_priv_key");
|
||||||
}
|
}
|
||||||
|
|
||||||
handleClickNewRandomToken=()=>{
|
handleClickNewRandomToken=()=>{
|
||||||
|
@ -15,5 +15,9 @@ export const getCookie = (name) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const writeCookie = (key,value) => {
|
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`
|
||||||
|
}
|
@ -43,6 +43,9 @@ ALLOWED_HOSTS = [
|
|||||||
"127.0.0.1",
|
"127.0.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Allows Session Cookie to be read by Javascript on Client side.
|
||||||
|
SESSION_COOKIE_HTTPONLY = False
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
Reference in New Issue
Block a user