Skip to content

Commit 3b120b8

Browse files
committed
[FIX] Show error messages of the input fields on the authentication pages
1 parent e69ab12 commit 3b120b8

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

resources/js/Pages/Auth/Login.svelte

+3-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import JetInput from '@/Jetstream/Input.svelte'
1313
import JetCheckbox from '@/Jetstream/Checkbox.svelte'
1414
import JetLabel from '@/Jetstream/Label.svelte'
15-
import ValidationErrors from "@/Jetstream/ValidationErrors.svelte";
15+
import JetInputError from '@/Jetstream/InputError.svelte'
1616
import {route} from '@/utils';
1717
1818
export let canResetPassword;
@@ -35,19 +35,18 @@
3535
<JetAuthenticationCard>
3636
<JetAuthenticationCardLogo slot="logo"/>
3737

38-
<ValidationErrors class="mt-4" errors={$form.errors} hasErrors={$form.hasErrors}/>
39-
4038
<form on:submit|preventDefault={login}>
4139
<div>
4240
<JetLabel id="email" label="Email"/>
4341
<JetInput bind:value={$form.email} id="email" type="email" class="mt-1 block w-full" required autofocus/>
44-
{#if $form.errors.email}{$form.errors.email}{/if}
42+
<JetInputError message={$form.errors.email}/>
4543
</div>
4644

4745
<div class="mt-4">
4846
<JetLabel id="password" label="Password"/>
4947
<JetInput bind:value={$form.password} id="password" type="password" class="mt-1 block w-full" required
5048
autocomplete="current-password"/>
49+
<JetInputError message={$form.errors.password}/>
5150
</div>
5251

5352
<div class="block mt-4">

resources/js/Pages/Auth/Register.svelte

+5-4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
import JetAuthenticationCardLogo from '@/Jetstream/AuthenticationCardLogo.svelte'
1111
import JetButton from '@/Jetstream/Button.svelte'
1212
import JetInput from '@/Jetstream/Input.svelte'
13-
// import JetCheckbox from '@/Jetstream/Checkbox.svelte'
13+
import JetInputError from '@/Jetstream/InputError.svelte'
1414
import JetLabel from '@/Jetstream/Label.svelte'
15-
import JetValidationErrors from '@/Jetstream/ValidationErrors.svelte'
1615
1716
$title = 'Register';
1817
@@ -34,30 +33,32 @@
3433
<JetAuthenticationCard>
3534
<JetAuthenticationCardLogo slot="logo"/>
3635

37-
<JetValidationErrors class="mb-4"/>
38-
3936
<form on:submit|preventDefault={register}>
4037
<div>
4138
<JetLabel id="name" label="Name"/>
4239
<JetInput id="name" class="mt-1 block w-full" bind:value={$form.name} required autofocus
4340
autocomplete="name"/>
41+
<JetInputError message={$form.errors.name}/>
4442
</div>
4543

4644
<div class="mt-4">
4745
<JetLabel id="email" label="Email"/>
4846
<JetInput id="email" type="email" class="mt-1 block w-full" bind:value={$form.email} required/>
47+
<JetInputError message={$form.errors.email}/>
4948
</div>
5049

5150
<div class="mt-4">
5251
<JetLabel id="password" label="Password"/>
5352
<JetInput id="password" type="password" class="mt-1 block w-full" bind:value={$form.password} required
5453
autocomplete="new-password"/>
54+
<JetInputError message={$form.errors.password}/>
5555
</div>
5656

5757
<div class="mt-4">
5858
<JetLabel id="password_confirmation" label="Confirm Password"/>
5959
<JetInput id="password_confirmation" type="password" class="mt-1 block w-full"
6060
bind:value={$form.password_confirmation} required autocomplete="new-password"/>
61+
<JetInputError message={$form.errors.password_confirmation}/>
6162
</div>
6263

6364
<!--

resources/js/Pages/Auth/TwoFactorChallenge.svelte

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import JetButton from '@/Jetstream/Button.svelte';
1111
import JetInput from '@/Jetstream/Input.svelte';
1212
import JetLabel from '@/Jetstream/Label.svelte';
13-
import JetValidationErrors from '@/Jetstream/ValidationErrors.svelte';
13+
import JetInputError from '@/Jetstream/InputError.svelte';
1414
import {useForm} from "@inertiajs/inertia-svelte";
1515
import {tick} from 'svelte';
1616
import {route} from "@/utils";
@@ -60,18 +60,18 @@
6060
{/if}
6161
</div>
6262

63-
<JetValidationErrors hasErrors={$form.hasErrors} class="mb-4"/>
64-
6563
<form on:submit|preventDefault={submit}>
6664
{#if !recovery}
6765
<JetLabel id="code" label="Code"/>
6866
<JetInput bind:this={codeInput} id="code" type="text" inputmode="numeric" class="mt-1 block w-full"
6967
bind:value={$form.code} autofocus autocomplete="one-time-code"/>
68+
<JetInputError message={$form.errors.code}/>
7069

7170
{:else}
7271
<JetLabel id="recovery_code" label="Recovery Code"/>
7372
<JetInput bind:this={recoveryCodeInput} id="recovery_code" type="text" class="mt-1 block w-full"
7473
bind:value={$form.recovery_code} autocomplete="one-time-code"/>
74+
<JetInputError message={$form.errors.code}/>
7575
{/if}
7676

7777
<div class="flex items-center justify-end mt-4">

0 commit comments

Comments
 (0)