Skip to content

Commit

Permalink
Fix PAT & Webauthn registration - Fixes #227
Browse files Browse the repository at this point in the history
  • Loading branch information
Bubka committed Sep 14, 2023
1 parent 43d7922 commit a0b3b66
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
6 changes: 3 additions & 3 deletions resources/js/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ router.beforeEach((to, from, next) => {
else if (to.name.startsWith('settings.')) {
if (to.params.returnTo == undefined) {
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) {
next({name: to.name, params: { returnTo: from.path }})
next({name: to.name, params: { ...to.params, returnTo: from.path }})
}
else {
next({name: to.name, params: { returnTo: '/accounts' }})
next({name: to.name, params: { ...to.params, returnTo: '/accounts' }})
}
}
else {
Expand Down
8 changes: 8 additions & 0 deletions resources/js/views/Error.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@
});
},
beforeRouteEnter(to, from, next) {
next(vm => {
if (from.params.returnTo) {
to.params.returnTo = from.params.returnTo
}
})
},
}
</script>
Expand Down
4 changes: 2 additions & 2 deletions resources/js/views/settings/Credentials/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
}
},
props: ['id', 'name'],
props: ['credentialId', 'name'],
methods: {
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 ) {
this.$notify({ type: 'is-success', text: this.$t('auth.webauthn.device_successfully_registered') })
Expand Down
2 changes: 1 addition & 1 deletion resources/js/views/settings/WebAuthn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
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: { credentialId: publicKeyCredential.id, name: this.$t('auth.webauthn.my_device') } })
})
.catch(error => {
if( error.response.status === 422 ) {
Expand Down

0 comments on commit a0b3b66

Please sign in to comment.