Skip to content

Commit

Permalink
Updated the mobileapp with logout functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
didintern committed May 10, 2020
1 parent 01e9f91 commit b40742d
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 30 deletions.
21 changes: 11 additions & 10 deletions src/layouts/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
<q-btn dense flat round icon="exit_to_app" @click="logout()" />
</q-toolbar>
</q-header>
<q-drawer show-if-above v-model="right" side="right" bordered>
<q-btn-dropdown auto-close="" stretch="" flat="" icon="person">
<q-list>
<q-item to="/auth/register">
<q-item-section>Logoff</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</q-drawer>
//- <q-drawer show-if-above v-model="right" side="right" bordered>
//- <q-btn-dropdown auto-close="" stretch="" flat="" icon="person">
//- <q-list>
//- <q-item to="/auth/register">
//- <q-item-section>Logoff</q-item-section>
//- </q-item>
//- </q-list>
//- </q-btn-dropdown>
//- </q-drawer>
<q-footer height-hint="98" class="footer-height">
<q-tabs class="bg-primary text-white" align="justify" >
<q-route-tab v-model="tab" name="wallet" icon="account_balance_wallet" to="/" ></q-route-tab>
Expand All @@ -39,7 +39,7 @@ export default {
components: { copyRight },
beforeDestroy () {
this.$store.commit('wallet/UPDATE_ADDRESS', '')
this.$store.commit('wallet/UPDATE_SEEDSTORE', {})
this.$store.commit('wallet/UPDATE_KEYSTORE', {})
},
data () {
return {
Expand All @@ -52,6 +52,7 @@ export default {
openURL,
logout () {
this.$store.commit('wallet/UPDATE_ADDRESS', '')
this.$store.commit('wallet/UPDATE_KEYSTORE', {})
this.$router.push('/auth/login')
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/pages/Auth.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,19 @@ export default {
},
async register () {
this.loading = true
let x = await this.setBaseUrl(this.baseUrl)
await this.setBaseUrl(this.baseUrl)
this.$store.commit('user/UPDATE_PASSWORD', this.password)
this.$store.commit('user/UPDATE_NAME', this.name)
this.$store.commit('user/UPDATE_EMAIL', this.email)
this.generate()
.then(res => {
this.onReset()
this.loading = false
})
.catch(err => {
this.loading = false
console.error(err)
})
this.loading = false
},
login () {
this.loading = true
Expand All @@ -156,6 +154,7 @@ export default {
this.loading = false
console.error(err)
})
this.loading = false
},
performAuthentication () {
return this.isRegisterUser
Expand Down
57 changes: 41 additions & 16 deletions src/pages/Signtx.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<template >
<q-page class="q-pa-lg">
<q-list bordered padding class="rounded-borders" style="max-width: 350px">
<q-item-label header>Your Keys</q-item-label>
<q-item clickable v-ripple v-for="app in sortedApps" :key="app.id" >
<div>
<span class="header width-50">Your Keys </span>
<span class="header width-50"><a @click="clearOldSession"><q-icon name="delete" /></a></span>
</div>
<!-- <q-item-label header>Your Keys </q-item-label>
<q-item-label header style="float:right">Clear </q-item-label> -->
<q-item clickable v-ripple v-for="app in apps" :key="app.id" >
<q-item-section avatar top>
<q-avatar icon="lock" color="grey" text-color="white" />
<q-avatar :icon="app.icon" color="grey" text-color="white" />
</q-item-section>

<q-item-section>
Expand Down Expand Up @@ -39,39 +44,59 @@ export default {
data () {
return {
scanText: 'Quick Brown Fox Jump Over a Lazy Dog',
apps:[]
apps: []
}
},
methods: {
...mapActions('wallet', [
'signMessageTx'
]),
clearOldSession () {
this.apps = this.apps.filter(app => {
if (app.color === 'green') {
return true
} else {
return false
}
})
},
onClick () {
this.signMessageTx(this.scanText)
.then(res => {
var today = new Date();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
this.apps = this.apps.filter(app => {
app.icon = 'lock'
app.color = 'orange'
return app
})
var today = new Date()
// var time = today.getHours() + ':' + today.getMinutes() + ':' + today.getSeconds()
let app = {}
app.id = Date.now()
app.login_time = time
app.name = 'Ae Laboratory '+'SSO'
app.login_time = today
app.name = 'Ae Laboratory ' + 'SSO'
app.color = 'green'
app.icon = 'lock_open'
this.apps.push(app)
})
.catch(err => {
console.error(err)
})
}
},
computed: {
sortedApps() {
return this.apps.reverse
}
},
}
}
</script>

<style>
.header {
color:#757575;
padding: 16px;
font-size: 0.875rem;
letter-spacing: 0.01786em;
}
.width-50 {
width:50%
}
.pull-right{
text-align: right;
}
</style>
2 changes: 2 additions & 0 deletions src/store/wallet/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ export function generate ({ state, commit, rootState, dispatch }, value) {
if (res.data.status === 'SUCCESS') {
dispatch('addSeedStore', randomSeed)
resolve(randomSeed)
commit('UPDATE_KEYSTORE', {})

this.$router.push('/auth/login')
} else {
Notify.create({
Expand Down

0 comments on commit b40742d

Please sign in to comment.