mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 10:31: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:
|
try:
|
||||||
import_pub_result = gpg.import_keys(pub_key)
|
import_pub_result = gpg.import_keys(pub_key)
|
||||||
pub_key = gpg.export_keys(import_pub_result.fingerprints[0])
|
pub_key = gpg.export_keys(import_pub_result.fingerprints[0])
|
||||||
except:
|
except Exception as e:
|
||||||
return (
|
return (
|
||||||
False,
|
False,
|
||||||
{
|
{
|
||||||
"bad_request":
|
"bad_request":
|
||||||
"Your PGP public key does not seem valid"
|
f"Your PGP public key does not seem valid. Exception: {str(e)}"
|
||||||
},
|
},
|
||||||
None,
|
None,
|
||||||
None)
|
None)
|
||||||
@ -115,12 +115,12 @@ class Logics:
|
|||||||
# Try to import the encrypted private key (without passphrase)
|
# Try to import the encrypted private key (without passphrase)
|
||||||
try:
|
try:
|
||||||
import_priv_result = gpg.import_keys(enc_priv_key)
|
import_priv_result = gpg.import_keys(enc_priv_key)
|
||||||
except:
|
except Exception as e:
|
||||||
return (
|
return (
|
||||||
False,
|
False,
|
||||||
{
|
{
|
||||||
"bad_request":
|
"bad_request":
|
||||||
"Your PGP private key does not seem valid"
|
f"Your PGP private key does not seem valid. Exception: {str(e)}"
|
||||||
},
|
},
|
||||||
None,
|
None,
|
||||||
None)
|
None)
|
||||||
|
@ -718,12 +718,11 @@ class UserView(APIView):
|
|||||||
user = authenticate(request, username=nickname, password=token_sha256)
|
user = authenticate(request, username=nickname, password=token_sha256)
|
||||||
if user is not None:
|
if user is not None:
|
||||||
login(request, user)
|
login(request, user)
|
||||||
# Sends the welcome back message, only if created +3 mins ago
|
|
||||||
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["public_key"] = user.profile.public_key
|
||||||
context["encrypted_private_key"] = user.profile.encrypted_private_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)):
|
||||||
|
context["found"] = "We found your Robot avatar. Welcome back!"
|
||||||
return Response(context, status=status.HTTP_202_ACCEPTED)
|
return Response(context, status=status.HTTP_202_ACCEPTED)
|
||||||
else:
|
else:
|
||||||
# It is unlikely, but maybe the nickname is taken (1 in 20 Billion chance)
|
# 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)
|
this.setState(null)
|
||||||
fetch('/api/info/')
|
fetch('/api/info/')
|
||||||
.then((response) => response.json())
|
.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,
|
& 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})
|
last_order_id: data.last_order_id ? data.last_order_id : null})
|
||||||
& this.props.setAppState({nickname:data.nickname, loading:false}));
|
& this.props.setAppState({nickname:data.nickname, loading:false}));
|
||||||
@ -130,7 +130,7 @@ bottomBarDesktop =()=>{
|
|||||||
<Grid container>
|
<Grid container>
|
||||||
|
|
||||||
<Grid item xs={1.9}>
|
<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} >
|
<ListItemButton onClick={this.handleClickOpenProfile} >
|
||||||
<Tooltip
|
<Tooltip
|
||||||
open={hasRewards || hasOrder}
|
open={hasRewards || hasOrder}
|
||||||
@ -292,7 +292,7 @@ bottomBarPhone =()=>{
|
|||||||
<Grid container>
|
<Grid container>
|
||||||
|
|
||||||
<Grid item xs={1.6}>
|
<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}
|
<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"):"")}>
|
||||||
|
@ -238,7 +238,7 @@ class UserGenPage extends Component {
|
|||||||
<Grid item xs={6}>
|
<Grid item xs={6}>
|
||||||
<Tooltip disableHoverListener enterTouchDelay={0} title={t("Copied!")}>
|
<Tooltip disableHoverListener enterTouchDelay={0} title={t("Copied!")}>
|
||||||
<IconButton
|
<IconButton
|
||||||
color="primary"
|
color={this.props.copiedToken ? "inherit":"primary"}
|
||||||
disabled={!(getCookie('robot_token')==this.state.token) || !this.props.avatarLoaded}
|
disabled={!(getCookie('robot_token')==this.state.token) || !this.props.avatarLoaded}
|
||||||
onClick={()=> (navigator.clipboard.writeText(getCookie('robot_token')) & this.props.setAppState({copiedToken:true}))}
|
onClick={()=> (navigator.clipboard.writeText(getCookie('robot_token')) & this.props.setAppState({copiedToken:true}))}
|
||||||
>
|
>
|
||||||
@ -275,10 +275,10 @@ class UserGenPage extends Component {
|
|||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} align="center">
|
<Grid item xs={12} align="center">
|
||||||
<ButtonGroup variant="contained" aria-label="outlined primary button group">
|
<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>
|
<Button color='inherit' style={{color: '#111111'}} onClick={this.handleClickOpenInfo}>{t("Info")}</Button>
|
||||||
<InfoDialog open={Boolean(this.state.openInfo)} onClose = {this.handleCloseInfo}/>
|
<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>
|
</ButtonGroup>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user