Make pgp keys read-only on admin panel. Improve homepage copy button behaviour.

This commit is contained in:
Reckless_Satoshi 2022-05-30 04:19:12 -07:00
parent 44f8712e18
commit 6f2aed095d
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
2 changed files with 12 additions and 3 deletions

View File

@ -132,6 +132,7 @@ class UserProfileAdmin(AdminChangeLinksMixin, admin.ModelAdmin):
change_links = ["user"]
readonly_fields = ["avatar_tag"]
search_fields = ["user__username","id"]
readonly_fields = ("public_key", "encrypted_private_key")
@admin.register(Currency)

View File

@ -225,7 +225,11 @@ class UserGenPage extends Component {
<Grid item xs={6}>
<Tooltip enterTouchDelay={250} title={t("Save token and PGP credentials to file")}>
<span>
<IconButton color="primary" disabled={getCookie('robot_token')==null || !this.props.avatarLoaded} onClick= {()=> saveAsJson(this.state.nickname+'.json', this.createJsonFile())}>
<IconButton
color="primary"
disabled={!(getCookie('robot_token')==this.state.token) || !this.props.avatarLoaded}
onClick={()=> saveAsJson(this.state.nickname+'.json', this.createJsonFile())}
>
<DownloadIcon sx={{width:22, height:22}}/>
</IconButton>
</span>
@ -233,8 +237,12 @@ class UserGenPage extends Component {
</Grid>
<Grid item xs={6}>
<Tooltip disableHoverListener enterTouchDelay={0} title={t("Copied!")}>
<IconButton onClick= {()=> (navigator.clipboard.writeText(this.state.token) & this.props.setAppState({copiedToken:true}))}>
<ContentCopy color={this.props.avatarLoaded & !this.props.copiedToken & !this.state.bad_request ? 'primary' : 'inherit' } sx={{width:18, height:18}}/>
<IconButton
color="primary"
disabled={!(getCookie('robot_token')==this.state.token) || !this.props.avatarLoaded}
onClick={()=> (navigator.clipboard.writeText(getCookie('robot_token')) & this.props.setAppState({copiedToken:true}))}
>
<ContentCopy sx={{width:18, height:18}}/>
</IconButton>
</Tooltip>
</Grid>