mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-26 10:15:40 +01:00
parent
4997562c45
commit
75860686f7
@ -52,7 +52,6 @@
|
|||||||
counter : null,
|
counter : null,
|
||||||
image : String,
|
image : String,
|
||||||
qrcode : null,
|
qrcode : null,
|
||||||
secretIsBase32Encoded : Number,
|
|
||||||
uri : String
|
uri : String
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@
|
|||||||
<div class="field has-addons">
|
<div class="field has-addons">
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<span class="select">
|
<span class="select">
|
||||||
<select @change="form.secret=''" v-model="form.secretIsBase32Encoded">
|
<select @change="form.secret=''" v-model="secretIsBase32Encoded">
|
||||||
<option v-for="format in secretFormats" :value="format.value">{{ format.text }}</option>
|
<option v-for="format in secretFormats" :value="format.value">{{ format.text }}</option>
|
||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
@ -187,13 +187,13 @@
|
|||||||
showAlternatives : false,
|
showAlternatives : false,
|
||||||
tempIcon: '',
|
tempIcon: '',
|
||||||
uri: '',
|
uri: '',
|
||||||
|
secretIsBase32Encoded: 0,
|
||||||
form: new Form({
|
form: new Form({
|
||||||
service: '',
|
service: '',
|
||||||
account: '',
|
account: '',
|
||||||
otp_type: '',
|
otp_type: '',
|
||||||
icon: '',
|
icon: '',
|
||||||
secret: '',
|
secret: '',
|
||||||
secretIsBase32Encoded: 0,
|
|
||||||
algorithm: '',
|
algorithm: '',
|
||||||
digits: null,
|
digits: null,
|
||||||
counter: null,
|
counter: null,
|
||||||
@ -241,6 +241,7 @@
|
|||||||
this.axios.post('/api/v1/twofaccounts/preview', { uri: this.uri }).then(response => {
|
this.axios.post('/api/v1/twofaccounts/preview', { uri: this.uri }).then(response => {
|
||||||
|
|
||||||
this.form.fill(response.data)
|
this.form.fill(response.data)
|
||||||
|
this.secretIsBase32Encoded = 1
|
||||||
this.tempIcon = response.data.icon ? response.data.icon : null
|
this.tempIcon = response.data.icon ? response.data.icon : null
|
||||||
this.showQuickForm = true
|
this.showQuickForm = true
|
||||||
})
|
})
|
||||||
@ -277,7 +278,7 @@
|
|||||||
this.form.icon = this.tempIcon
|
this.form.icon = this.tempIcon
|
||||||
|
|
||||||
// Secret to base32 if necessary
|
// Secret to base32 if necessary
|
||||||
this.form.secret = this.form.secretIsBase32Encoded ? this.form.secret : Base32.encode(this.form.secret).toString();
|
this.form.secret = this.secretIsBase32Encoded ? this.form.secret : Base32.encode(this.form.secret).toString();
|
||||||
|
|
||||||
await this.form.post('/api/v1/twofaccounts')
|
await this.form.post('/api/v1/twofaccounts')
|
||||||
|
|
||||||
@ -318,7 +319,7 @@
|
|||||||
// Then the otp described by the uri
|
// Then the otp described by the uri
|
||||||
this.axios.post('/api/v1/twofaccounts/preview', { uri: data.data }).then(response => {
|
this.axios.post('/api/v1/twofaccounts/preview', { uri: data.data }).then(response => {
|
||||||
this.form.fill(response.data)
|
this.form.fill(response.data)
|
||||||
this.form.secretIsBase32Encoded = 1
|
this.secretIsBase32Encoded = 1
|
||||||
this.tempIcon = response.data.icon ? response.data.icon : null
|
this.tempIcon = response.data.icon ? response.data.icon : null
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
<div class="field has-addons">
|
<div class="field has-addons">
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<span class="select">
|
<span class="select">
|
||||||
<select @change="form.secret=''" v-model="form.secretIsBase32Encoded">
|
<select @change="form.secret=''" v-model="secretIsBase32Encoded">
|
||||||
<option v-for="format in secretFormats" :value="format.value">{{ format.text }}</option>
|
<option v-for="format in secretFormats" :value="format.value">{{ format.text }}</option>
|
||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
@ -133,6 +133,7 @@
|
|||||||
counterIsLocked: true,
|
counterIsLocked: true,
|
||||||
twofaccountExists: false,
|
twofaccountExists: false,
|
||||||
tempIcon: '',
|
tempIcon: '',
|
||||||
|
secretIsBase32Encoded: null,
|
||||||
form: new Form({
|
form: new Form({
|
||||||
service: '',
|
service: '',
|
||||||
account: '',
|
account: '',
|
||||||
@ -140,7 +141,6 @@
|
|||||||
uri: '',
|
uri: '',
|
||||||
icon: '',
|
icon: '',
|
||||||
secret: '',
|
secret: '',
|
||||||
secretIsBase32Encoded: null,
|
|
||||||
algorithm: '',
|
algorithm: '',
|
||||||
digits: null,
|
digits: null,
|
||||||
counter: null,
|
counter: null,
|
||||||
@ -196,7 +196,7 @@
|
|||||||
const { data } = await this.axios.get('/api/v1/twofaccounts/' + this.$route.params.twofaccountId)
|
const { data } = await this.axios.get('/api/v1/twofaccounts/' + this.$route.params.twofaccountId)
|
||||||
|
|
||||||
this.form.fill(data)
|
this.form.fill(data)
|
||||||
this.form.secretIsBase32Encoded = 1
|
this.secretIsBase32Encoded = 1
|
||||||
this.twofaccountExists = true
|
this.twofaccountExists = true
|
||||||
|
|
||||||
// set account icon as temp icon
|
// set account icon as temp icon
|
||||||
@ -218,7 +218,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Secret to base32 if necessary
|
// Secret to base32 if necessary
|
||||||
this.form.secret = this.form.secretIsBase32Encoded ? this.form.secret : Base32.encode(this.form.secret).toString();
|
this.form.secret = this.secretIsBase32Encoded ? this.form.secret : Base32.encode(this.form.secret).toString();
|
||||||
|
|
||||||
await this.form.put('/api/v1/twofaccounts/' + this.$route.params.twofaccountId)
|
await this.form.put('/api/v1/twofaccounts/' + this.$route.params.twofaccountId)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user