2022-03-15 14:47:07 +01:00
|
|
|
<template>
|
|
|
|
<form-wrapper :title="$t('auth.webauthn.rename_device')">
|
|
|
|
<form @submit.prevent="updateCredential" @keydown="form.onKeydown($event)">
|
|
|
|
<form-field :form="form" fieldName="name" inputType="text" :label="$t('commons.new_name')" autofocus />
|
2022-09-17 19:31:11 +02:00
|
|
|
<form-buttons
|
|
|
|
:submitId="'btnEditCredential'"
|
|
|
|
:isBusy="form.isBusy"
|
|
|
|
:caption="$t('commons.save')"
|
|
|
|
:showCancelButton="true"
|
|
|
|
cancelLandingView="settings.webauthn.devices" />
|
2022-03-15 14:47:07 +01:00
|
|
|
</form>
|
|
|
|
</form-wrapper>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
import Form from './../../../components/Form'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
form: new Form({
|
|
|
|
name: this.name,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2023-09-14 13:39:48 +02:00
|
|
|
props: ['credentialId', 'name'],
|
2022-03-15 14:47:07 +01:00
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
async updateCredential() {
|
|
|
|
|
2023-09-14 13:39:48 +02:00
|
|
|
await this.form.patch('/webauthn/credentials/' + this.credentialId + '/name')
|
2022-03-15 14:47:07 +01:00
|
|
|
|
|
|
|
if( this.form.errors.any() === false ) {
|
2022-09-19 12:19:34 +02:00
|
|
|
this.$notify({ type: 'is-success', text: this.$t('auth.webauthn.device_successfully_registered') })
|
2022-07-07 18:04:04 +02:00
|
|
|
this.$router.push({name: 'settings.webauthn.devices', params: { toRefresh: true }})
|
2022-03-15 14:47:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
cancelCreation: function() {
|
|
|
|
|
2022-07-07 18:04:04 +02:00
|
|
|
this.$router.push({ name: 'settings.webauthn.devices' });
|
2022-03-15 14:47:07 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
</script>
|