2019-06-24 00:29:14 +02:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<div class="container">
|
|
|
|
<div class="buttons are-large is-centered">
|
2019-06-28 01:16:51 +02:00
|
|
|
<span v-for="account in accounts" class="button is-black twofaccount" @click.stop="getAccount(account.id)">
|
2019-06-24 00:29:14 +02:00
|
|
|
<img src="https://fakeimg.pl/64x64/">
|
|
|
|
{{ account.name }}
|
|
|
|
<span class="is-family-primary is-size-7 has-text-grey">{{ account.email }}</span>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<modal v-model="ModalIsActive">
|
2019-06-28 01:16:51 +02:00
|
|
|
<modal-twofaccount
|
|
|
|
:name='twofaccount.name'
|
|
|
|
:icon='twofaccount.icon'
|
|
|
|
:email='twofaccount.email'>
|
|
|
|
<one-time-password :AccountId='twofaccount.id' ></one-time-password>
|
|
|
|
</modal-twofaccount>
|
2019-06-24 00:29:14 +02:00
|
|
|
</modal>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import Modal from '../components/Modal'
|
2019-06-28 01:16:51 +02:00
|
|
|
import ModalTwofaccount from '../components/ModalTwofaccount'
|
|
|
|
import OneTimePassword from '../components/OneTimePassword'
|
|
|
|
|
|
|
|
// const ModalTwofaccount = {
|
|
|
|
// props: ['id', 'name', 'email', 'icon', 'totp'],
|
|
|
|
// template: `
|
|
|
|
// <section class="section">
|
|
|
|
// <div class="columns is-centered">
|
|
|
|
// <div class="column is-three-quarters">
|
|
|
|
// <div class="box has-text-centered has-background-black-ter ">
|
|
|
|
// <figure class="image is-64x64" style="display: inline-block">
|
|
|
|
// <img :src="icon">
|
|
|
|
// </figure>
|
|
|
|
// <p class="is-size-4 has-text-grey-light">{{ name }}</p>
|
|
|
|
// <p class="is-size-6 has-text-grey">{{ email }}</p>
|
|
|
|
// <p id="otp" title="refresh" class="is-size-1 has-text-white">{{ totp }}</p>
|
|
|
|
// <ul class="dots">
|
|
|
|
// <li data-is-active style="display:none"></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li>
|
|
|
|
// </ul>
|
|
|
|
// </div>
|
|
|
|
// </div>
|
|
|
|
// </div>
|
|
|
|
// </section>
|
|
|
|
// `
|
|
|
|
// }
|
|
|
|
|
2019-06-24 00:29:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data(){
|
|
|
|
return {
|
|
|
|
accounts : [],
|
|
|
|
ModalIsActive : false,
|
|
|
|
twofaccount: {}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted(){
|
|
|
|
let token = localStorage.getItem('jwt')
|
|
|
|
|
|
|
|
axios.defaults.headers.common['Content-Type'] = 'application/json'
|
|
|
|
axios.defaults.headers.common['Authorization'] = 'Bearer ' + token
|
|
|
|
|
|
|
|
axios.get('api/twofaccounts').then(response => {
|
|
|
|
response.data.forEach((data) => {
|
|
|
|
this.accounts.push({
|
|
|
|
id : data.id,
|
|
|
|
name : data.name,
|
|
|
|
email : data.email,
|
|
|
|
icon : data.icon
|
|
|
|
})
|
|
|
|
})
|
|
|
|
// this.loadTasks()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
Modal,
|
2019-06-28 01:16:51 +02:00
|
|
|
ModalTwofaccount,
|
|
|
|
OneTimePassword
|
2019-06-24 00:29:14 +02:00
|
|
|
},
|
|
|
|
methods: {
|
2019-06-28 01:16:51 +02:00
|
|
|
getAccount: function (id) {
|
2019-06-24 00:29:14 +02:00
|
|
|
let token = localStorage.getItem('jwt')
|
2019-06-28 01:16:51 +02:00
|
|
|
let accountId = id
|
2019-06-24 00:29:14 +02:00
|
|
|
|
|
|
|
axios.defaults.headers.common['Content-Type'] = 'application/json'
|
|
|
|
axios.defaults.headers.common['Authorization'] = 'Bearer ' + token
|
|
|
|
|
|
|
|
axios.get('api/twofaccounts/' + id).then(response => {
|
2019-06-28 01:16:51 +02:00
|
|
|
this.twofaccount.id = response.data.id
|
|
|
|
this.twofaccount.name = response.data.name
|
|
|
|
this.twofaccount.email = response.data.email
|
|
|
|
this.twofaccount.icon = response.data.icon
|
2019-06-24 00:29:14 +02:00
|
|
|
|
2019-06-28 01:16:51 +02:00
|
|
|
this.ModalIsActive = true;
|
2019-06-24 00:29:14 +02:00
|
|
|
|
2019-06-28 01:16:51 +02:00
|
|
|
})
|
2019-06-24 00:29:14 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
beforeRouteEnter (to, from, next) {
|
|
|
|
if ( ! localStorage.getItem('jwt')) {
|
|
|
|
return next('login')
|
|
|
|
}
|
|
|
|
|
|
|
|
next()
|
|
|
|
}
|
|
|
|
}
|
2019-06-28 01:16:51 +02:00
|
|
|
|
2019-06-24 00:29:14 +02:00
|
|
|
</script>
|
|
|
|
|