mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-04-01 11:26:07 +02:00
Fix PAT & Webauthn registration - Fixes #227
This commit is contained in:
parent
43d7922732
commit
a0b3b668bb
6
resources/js/routes.js
vendored
6
resources/js/routes.js
vendored
@ -88,13 +88,13 @@ router.beforeEach((to, from, next) => {
|
|||||||
else if (to.name.startsWith('settings.')) {
|
else if (to.name.startsWith('settings.')) {
|
||||||
if (to.params.returnTo == undefined) {
|
if (to.params.returnTo == undefined) {
|
||||||
if (from.params.returnTo) {
|
if (from.params.returnTo) {
|
||||||
next({name: to.name, params: { returnTo: from.params.returnTo }})
|
next({name: to.name, params: { ...to.params, returnTo: from.params.returnTo }})
|
||||||
}
|
}
|
||||||
else if (from.name) {
|
else if (from.name) {
|
||||||
next({name: to.name, params: { returnTo: from.path }})
|
next({name: to.name, params: { ...to.params, returnTo: from.path }})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
next({name: to.name, params: { returnTo: '/accounts' }})
|
next({name: to.name, params: { ...to.params, returnTo: '/accounts' }})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -88,6 +88,14 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
beforeRouteEnter(to, from, next) {
|
||||||
|
next(vm => {
|
||||||
|
if (from.params.returnTo) {
|
||||||
|
to.params.returnTo = from.params.returnTo
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -25,13 +25,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
props: ['id', 'name'],
|
props: ['credentialId', 'name'],
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
async updateCredential() {
|
async updateCredential() {
|
||||||
|
|
||||||
await this.form.patch('/webauthn/credentials/' + this.id + '/name')
|
await this.form.patch('/webauthn/credentials/' + this.credentialId + '/name')
|
||||||
|
|
||||||
if( this.form.errors.any() === false ) {
|
if( this.form.errors.any() === false ) {
|
||||||
this.$notify({ type: 'is-success', text: this.$t('auth.webauthn.device_successfully_registered') })
|
this.$notify({ type: 'is-success', text: this.$t('auth.webauthn.device_successfully_registered') })
|
||||||
|
@ -183,7 +183,7 @@
|
|||||||
|
|
||||||
this.axios.post('/webauthn/register', publicKeyCredential, {returnError: true})
|
this.axios.post('/webauthn/register', publicKeyCredential, {returnError: true})
|
||||||
.then(response => {
|
.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: { credentialId: publicKeyCredential.id, name: this.$t('auth.webauthn.my_device') } })
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if( error.response.status === 422 ) {
|
if( error.response.status === 422 ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user