feat: replace password comparison with password toggle
This commit is contained in:
parent
05e054f501
commit
aa12bffcbc
1 changed files with 20 additions and 17 deletions
|
@ -53,33 +53,20 @@
|
||||||
name="password"
|
name="password"
|
||||||
:placeholder="$t('user.auth.passwordPlaceholder')"
|
:placeholder="$t('user.auth.passwordPlaceholder')"
|
||||||
required
|
required
|
||||||
type="password"
|
:type="passwordFieldType"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
v-model="credentials.password"
|
v-model="credentials.password"
|
||||||
@keyup.enter="submit"
|
@keyup.enter="submit"
|
||||||
@focusout="validatePassword"
|
@focusout="validatePassword"
|
||||||
/>
|
/>
|
||||||
|
<a @click="togglePasswordFieldType" class="password-field-type-toggle">
|
||||||
|
<icon :icon="passwordFieldType === 'password' ? 'eye' : 'eye-slash'"/>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<p class="help is-danger" v-if="!passwordValid">
|
<p class="help is-danger" v-if="!passwordValid">
|
||||||
{{ $t('user.auth.passwordRequired') }}
|
{{ $t('user.auth.passwordRequired') }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
|
||||||
<label class="label" for="passwordValidation">{{ $t('user.auth.passwordRepeat') }}</label>
|
|
||||||
<div class="control">
|
|
||||||
<input
|
|
||||||
class="input"
|
|
||||||
id="passwordValidation"
|
|
||||||
name="passwordValidation"
|
|
||||||
:placeholder="$t('user.auth.passwordPlaceholder')"
|
|
||||||
required
|
|
||||||
type="password"
|
|
||||||
autocomplete="new-password"
|
|
||||||
v-model="passwordValidation"
|
|
||||||
@keyup.enter="submit"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field is-grouped">
|
<div class="field is-grouped">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
|
@ -157,6 +144,13 @@ const everythingValid = computed(() => {
|
||||||
passwordValid.value
|
passwordValid.value
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const passwordFieldType = ref('password')
|
||||||
|
const togglePasswordFieldType = () => {
|
||||||
|
passwordFieldType.value = passwordFieldType.value === 'password'
|
||||||
|
? 'text'
|
||||||
|
: 'password'
|
||||||
|
}
|
||||||
|
|
||||||
async function submit() {
|
async function submit() {
|
||||||
errorMessage.value = ''
|
errorMessage.value = ''
|
||||||
|
|
||||||
|
@ -171,3 +165,12 @@ async function submit() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.password-field-type-toggle {
|
||||||
|
position: absolute;
|
||||||
|
top: .5rem;
|
||||||
|
right: 1rem;
|
||||||
|
color: var(--grey-400);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue