mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-23 13:31:27 +02:00
Handle Validation errors from webauthn during device registration (#200)
This commit is contained in:
parent
aed5956b23
commit
085eb25532
@ -117,10 +117,19 @@
|
|||||||
|
|
||||||
const publicKeyCredential = this.webauthn.parseOutgoingCredentials(bufferedCredentials);
|
const publicKeyCredential = this.webauthn.parseOutgoingCredentials(bufferedCredentials);
|
||||||
|
|
||||||
this.axios.post('/webauthn/register', publicKeyCredential).then(response => {
|
this.axios.post('/webauthn/register', publicKeyCredential, {returnError: true})
|
||||||
|
.then(response => {
|
||||||
this.deviceId = publicKeyCredential.id
|
this.deviceId = publicKeyCredential.id
|
||||||
this.deviceRegistered = true
|
this.deviceRegistered = true
|
||||||
})
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if( error.response.status === 422 ) {
|
||||||
|
this.$notify({ type: 'is-danger', text: error.response.data.message })
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.$router.push({ name: 'genericError', params: { err: error.response } });
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -172,9 +172,18 @@
|
|||||||
|
|
||||||
const publicKeyCredential = this.webauthn.parseOutgoingCredentials(bufferedCredentials);
|
const publicKeyCredential = this.webauthn.parseOutgoingCredentials(bufferedCredentials);
|
||||||
|
|
||||||
this.axios.post('/webauthn/register', publicKeyCredential).then(response => {
|
this.axios.post('/webauthn/register', publicKeyCredential, {returnError: true})
|
||||||
|
.then(response => {
|
||||||
this.$router.push({ name: 'settings.webauthn.editCredential', params: { id: publicKeyCredential.id, name: this.$t('auth.webauthn.my_device') } })
|
this.$router.push({ name: 'settings.webauthn.editCredential', params: { id: publicKeyCredential.id, name: this.$t('auth.webauthn.my_device') } })
|
||||||
})
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if( error.response.status === 422 ) {
|
||||||
|
this.$notify({ type: 'is-danger', text: error.response.data.message })
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.$router.push({ name: 'genericError', params: { err: error.response } });
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user