feat: user logout and data clear
This commit is contained in:
parent
da00113666
commit
97cc7a3e17
4 changed files with 77 additions and 19 deletions
|
|
@ -1,8 +1,47 @@
|
|||
<q-card>
|
||||
<div class="q-pa-md">
|
||||
<div class="q-gutter-y-md">
|
||||
User Config
|
||||
<q-card-section v-if="account">
|
||||
<div class="row">
|
||||
<div class="col-10">
|
||||
<q-input v-model="account.npub" readonly disbled outlined :hint="account.pubkey" type="text" label="Public Key"
|
||||
class="q-mb-md">
|
||||
<template v-slot:append>
|
||||
<q-btn @click="copyText(account.npub)" icon="content_copy" label="Npub" flat
|
||||
color="gray float-right q-mt-sm"></q-btn>
|
||||
</template>
|
||||
</q-input>
|
||||
</div>
|
||||
|
||||
<div class="col-2 auto-width">
|
||||
<q-btn @click="copyText(account.pubkey)" icon="content_copy" label="Hex" flat
|
||||
color="gray float-right q-mt-sm"></q-btn>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-10">
|
||||
<q-input v-model="account.nsec" readonly disbled outlined type="password" label="Private Key"
|
||||
class="q-mb-md">
|
||||
<template v-slot:append>
|
||||
<q-btn @click="copyText(account.nsec)" icon="content_copy" label="Nsec" flat color="gray float-right q-mt-sm"></q-btn>
|
||||
</template>
|
||||
</q-input>
|
||||
</div>
|
||||
|
||||
<div class="col-2 auto-width">
|
||||
<q-btn @click="copyText(account.privkey)" icon="content_copy" label="Hex" flat color="gray float-right q-mt-sm"></q-btn>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
<q-card-section>
|
||||
<div v-if="account" class="float-right">
|
||||
<q-checkbox v-model="clearAllData" label="Clear All Data"></q-checkbox>
|
||||
<q-btn @click="logout" flat label="Logout" icon="logout" class="q-ml-lg" color="primary"></q-btn>
|
||||
</div>
|
||||
<div v-else>
|
||||
<strong>No Account</strong>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-card-section></q-card-section>
|
||||
|
||||
</q-card>
|
||||
|
|
@ -2,15 +2,27 @@ async function userConfig(path) {
|
|||
const template = await loadTemplateAsync(path)
|
||||
Vue.component('user-config', {
|
||||
name: 'user-config',
|
||||
props: ['user',],
|
||||
props: ['account'],
|
||||
template,
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
clearAllData: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
logout: async function () {
|
||||
LNbits.utils
|
||||
.confirmDialog(
|
||||
'Please make sure you save your private key! You will not be able to recover it later!'
|
||||
)
|
||||
.onOk(async () => {
|
||||
this.$emit('logout', { clearAllData: this.clearAllData })
|
||||
})
|
||||
},
|
||||
copyText(text) {
|
||||
this.$emit('copy-text', text)
|
||||
}
|
||||
},
|
||||
created: async function () {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue