mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-23 21:41:44 +02:00
Fix account loading when requesting an OTD
This commit is contained in:
parent
326866e1c7
commit
7fca9cdf3c
@ -16,6 +16,7 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
id: null,
|
||||||
service: '',
|
service: '',
|
||||||
account: '',
|
account: '',
|
||||||
icon: '',
|
icon: '',
|
||||||
@ -25,29 +26,29 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
props: ['twofaccountid'],
|
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
getAccount: function() {
|
getAccount: function(id) {
|
||||||
|
|
||||||
axios.get('api/twofaccounts/' + this.twofaccountid)
|
this.id = id
|
||||||
|
|
||||||
|
axios.get('api/twofaccounts/' + this.id)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|
||||||
this.service = response.data.service
|
this.service = response.data.service
|
||||||
this.account = response.data.account
|
this.account = response.data.account
|
||||||
this.icon = response.data.icon
|
this.icon = response.data.icon
|
||||||
|
|
||||||
this.getOTP(this.twofaccountid)
|
this.getOTP()
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
this.$router.push({ name: 'genericError', params: { err: error.response } });
|
this.$router.push({ name: 'genericError', params: { err: error.response } });
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getOTP: function(id) {
|
getOTP: function() {
|
||||||
|
|
||||||
axios.get('api/twofaccounts/' + id + '/totp').then(response => {
|
axios.get('api/twofaccounts/' + this.id + '/totp').then(response => {
|
||||||
let spacePosition = Math.ceil(response.data.totp.length / 2);
|
let spacePosition = Math.ceil(response.data.totp.length / 2);
|
||||||
|
|
||||||
this.totp = response.data.totp.substr(0, spacePosition) + " " + response.data.totp.substr(spacePosition);
|
this.totp = response.data.totp.substr(0, spacePosition) + " " + response.data.totp.substr(spacePosition);
|
||||||
|
@ -138,9 +138,14 @@
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async showAccount(id) {
|
async showAccount(id) {
|
||||||
|
|
||||||
this.$refs.TwofaccountShow.twofaccountid = id
|
if( id ) {
|
||||||
await this.$refs.TwofaccountShow.getAccount()
|
await this.$refs.TwofaccountShow.getAccount(id)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let err = new Error("Id missing")
|
||||||
|
this.$router.push({ name: 'genericError', params: { err: err } });
|
||||||
|
}
|
||||||
|
|
||||||
this.ShowTwofaccountInModal = true
|
this.ShowTwofaccountInModal = true
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user