mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-18 12:11:35 +00:00
Fix missing PGP keys when early login. Fix avatar not found when make/book is clicked.
This commit is contained in:
parent
5b214c3b9c
commit
bedac53e29
@ -102,12 +102,12 @@ class Logics:
|
||||
try:
|
||||
import_pub_result = gpg.import_keys(pub_key)
|
||||
pub_key = gpg.export_keys(import_pub_result.fingerprints[0])
|
||||
except:
|
||||
except Exception as e:
|
||||
return (
|
||||
False,
|
||||
{
|
||||
"bad_request":
|
||||
"Your PGP public key does not seem valid"
|
||||
f"Your PGP public key does not seem valid. Exception: {str(e)}"
|
||||
},
|
||||
None,
|
||||
None)
|
||||
@ -115,12 +115,12 @@ class Logics:
|
||||
# Try to import the encrypted private key (without passphrase)
|
||||
try:
|
||||
import_priv_result = gpg.import_keys(enc_priv_key)
|
||||
except:
|
||||
except Exception as e:
|
||||
return (
|
||||
False,
|
||||
{
|
||||
"bad_request":
|
||||
"Your PGP private key does not seem valid"
|
||||
f"Your PGP private key does not seem valid. Exception: {str(e)}"
|
||||
},
|
||||
None,
|
||||
None)
|
||||
|
@ -718,12 +718,11 @@ class UserView(APIView):
|
||||
user = authenticate(request, username=nickname, password=token_sha256)
|
||||
if user is not None:
|
||||
login(request, user)
|
||||
context["public_key"] = user.profile.public_key
|
||||
context["encrypted_private_key"] = user.profile.encrypted_private_key
|
||||
# Sends the welcome back message, only if created +3 mins ago
|
||||
if request.user.date_joined < (timezone.now() -
|
||||
timedelta(minutes=3)):
|
||||
if request.user.date_joined < (timezone.now() - timedelta(minutes=3)):
|
||||
context["found"] = "We found your Robot avatar. Welcome back!"
|
||||
context["public_key"] = user.profile.public_key
|
||||
context["encrypted_private_key"] = user.profile.encrypted_private_key
|
||||
return Response(context, status=status.HTTP_202_ACCEPTED)
|
||||
else:
|
||||
# It is unlikely, but maybe the nickname is taken (1 in 20 Billion chance)
|
||||
|
@ -61,7 +61,7 @@ class BottomBar extends Component {
|
||||
this.setState(null)
|
||||
fetch('/api/info/')
|
||||
.then((response) => response.json())
|
||||
.then((data) => this.setState(data)
|
||||
.then((data) => this.setState(data) & console.log(data)
|
||||
& this.setState({active_order_id: data.active_order_id ? data.active_order_id : null,
|
||||
last_order_id: data.last_order_id ? data.last_order_id : null})
|
||||
& this.props.setAppState({nickname:data.nickname, loading:false}));
|
||||
@ -130,7 +130,7 @@ bottomBarDesktop =()=>{
|
||||
<Grid container>
|
||||
|
||||
<Grid item xs={1.9}>
|
||||
<div style={{display: this.props.avatarLoaded ? '':'none'}}>
|
||||
<div style={{display: this.props.avatarLoaded && getCookie('robot_token')==this.props.token ? '':'none'}}>
|
||||
<ListItemButton onClick={this.handleClickOpenProfile} >
|
||||
<Tooltip
|
||||
open={hasRewards || hasOrder}
|
||||
@ -292,7 +292,7 @@ bottomBarPhone =()=>{
|
||||
<Grid container>
|
||||
|
||||
<Grid item xs={1.6}>
|
||||
<div style={{display: this.props.avatarLoaded ? '':'none'}}>
|
||||
<div style={{display: this.props.avatarLoaded && getCookie('robot_token')==this.props.token ? '':'none'}}>
|
||||
<Tooltip open={hasRewards || hasOrder}
|
||||
title={(hasRewards ? t("You can claim satoshis!")+" ": "" )+
|
||||
(hasOrder ? t("You have an active order"):"")}>
|
||||
|
@ -227,7 +227,7 @@ class UserGenPage extends Component {
|
||||
<span>
|
||||
<IconButton
|
||||
color="primary"
|
||||
disabled={!(getCookie('robot_token')==this.state.token) || !this.props.avatarLoaded}
|
||||
disabled={!(getCookie('robot_token')==this.state.token) || !this.props.avatarLoaded}
|
||||
onClick={()=> saveAsJson(this.state.nickname+'.json', this.createJsonFile())}
|
||||
>
|
||||
<DownloadIcon sx={{width:22, height:22}}/>
|
||||
@ -238,7 +238,7 @@ class UserGenPage extends Component {
|
||||
<Grid item xs={6}>
|
||||
<Tooltip disableHoverListener enterTouchDelay={0} title={t("Copied!")}>
|
||||
<IconButton
|
||||
color="primary"
|
||||
color={this.props.copiedToken ? "inherit":"primary"}
|
||||
disabled={!(getCookie('robot_token')==this.state.token) || !this.props.avatarLoaded}
|
||||
onClick={()=> (navigator.clipboard.writeText(getCookie('robot_token')) & this.props.setAppState({copiedToken:true}))}
|
||||
>
|
||||
@ -275,10 +275,10 @@ class UserGenPage extends Component {
|
||||
</Grid>
|
||||
<Grid item xs={12} align="center">
|
||||
<ButtonGroup variant="contained" aria-label="outlined primary button group">
|
||||
<Button disabled={this.state.loadingRobot} color='primary' to='/make/' component={Link}>{t("Make Order")}</Button>
|
||||
<Button disabled={this.state.loadingRobot || !(getCookie('robot_token')==this.props.token)} color='primary' to='/make/' component={Link}>{t("Make Order")}</Button>
|
||||
<Button color='inherit' style={{color: '#111111'}} onClick={this.handleClickOpenInfo}>{t("Info")}</Button>
|
||||
<InfoDialog open={Boolean(this.state.openInfo)} onClose = {this.handleCloseInfo}/>
|
||||
<Button disabled={this.state.loadingRobot} color='secondary' to='/book/' component={Link}>{t("View Book")}</Button>
|
||||
<Button disabled={this.state.loadingRobot || !(getCookie('robot_token')==this.props.token)} color='secondary' to='/book/' component={Link}>{t("View Book")}</Button>
|
||||
</ButtonGroup>
|
||||
</Grid>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user