1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-08-05 05:05:17 +02:00

feat: add password validation and error messages, enhance CityCard styling, and update localization for email and password prompts

This commit is contained in:
Sean Morley 2025-01-09 18:25:51 -05:00
parent 22790ae7c0
commit 013a2cc751
12 changed files with 154 additions and 24 deletions

View file

@ -194,10 +194,15 @@ export const actions: Actions = {
if (password1 !== password2) {
return fail(400, { message: 'settings.password_does_not_match' });
}
if (!current_password) {
current_password = null;
}
if (password1 && password1?.length < 6) {
return fail(400, { message: 'settings.password_too_short' });
}
let csrfToken = await fetchCSRFToken();
if (current_password) {

View file

@ -345,6 +345,11 @@
class="block w-full mt-1 input input-bordered input-primary"
/>
</div>
{#if $page.form?.message}
<div class="alert alert-warning">
{$t($page.form?.message)}
</div>
{/if}
<div
class="tooltip tooltip-warning"
@ -394,7 +399,7 @@
{/if}
</div>
<form class="mt-4" on:submit={addEmail}>
<form class="mt-4" on:submit|preventDefault={addEmail}>
<input
type="email"
id="new_email"
@ -403,7 +408,7 @@
placeholder={$t('settings.new_email')}
class="block w-full input input-bordered input-primary"
/>
<button class="w-full mt-4 btn btn-primary py-2">{$t('settings.email_change')}</button>
<button class="w-full mt-4 btn btn-primary py-2">{$t('settings.add_email')}</button>
</form>
</div>
</section>