chore: better function naming in password components

This commit is contained in:
Dominik Pschenitschni 2023-04-12 16:15:40 +02:00
parent 795b26e1dd
commit a416d26f7c
Signed by untrusted user: dpschen
GPG Key ID: B257AC0149F43A77
2 changed files with 9 additions and 10 deletions

View File

@ -11,17 +11,17 @@
{{ $t('user.auth.login') }}
</x-button>
</div>
<form @submit.prevent="submit" id="form" v-if="!successMessage">
<form @submit.prevent="resetPassword" id="form" v-if="!successMessage">
<div class="field">
<label class="label" for="password">{{ $t('user.auth.password') }}</label>
<Password @submit="submit" @update:modelValue="v => credentials.password = v"/>
<Password @submit="resetPassword" @update:modelValue="v => credentials.password = v"/>
</div>
<div class="field is-grouped">
<div class="control">
<x-button
:loading="passwordResetService.loading"
@click="submit"
@click="resetPassword"
>
{{ $t('user.auth.resetPassword') }}
</x-button>
@ -47,7 +47,7 @@ const passwordResetService = reactive(new PasswordResetService())
const errorMsg = ref('')
const successMessage = ref('')
async function submit() {
async function resetPassword() {
errorMsg.value = ''
if(credentials.password === '') {

View File

@ -11,7 +11,7 @@
{{ $t('user.auth.login') }}
</x-button>
</div>
<form @submit.prevent="submit" v-if="!isSuccess">
<form @submit.prevent="requestPasswordReset" v-if="!isSuccess">
<div class="field">
<label class="label" for="email">{{ $t('user.auth.email') }}</label>
<div class="control">
@ -30,7 +30,7 @@
<div class="field is-grouped">
<div class="control">
<x-button
@click="submit"
type="submit"
:loading="passwordResetService.loading"
>
{{ $t('user.auth.resetPasswordAction') }}
@ -45,19 +45,18 @@
</template>
<script setup lang="ts">
import {ref, reactive} from 'vue'
import {ref, shallowReactive} from 'vue'
import PasswordResetModel from '@/models/passwordReset'
import PasswordResetService from '@/services/passwordReset'
import Message from '@/components/misc/message.vue'
// Not sure if this instance needs a shalloRef at all
const passwordResetService = reactive(new PasswordResetService())
const passwordResetService = shallowReactive(new PasswordResetService())
const passwordReset = ref(new PasswordResetModel())
const errorMsg = ref('')
const isSuccess = ref(false)
async function submit() {
async function requestPasswordReset() {
errorMsg.value = ''
try {
await passwordResetService.requestResetPassword(passwordReset.value)