Merge pull request #2381 from webdevcody/persist-name-on-failed-submit-2
Persist Registration Name & Email on password validation errors
This commit is contained in:
commit
bdde9b063c
@ -1,3 +1,13 @@
|
||||
<?php
|
||||
function getOldOrLocal($key, $localValue)
|
||||
{
|
||||
return old($key) != '' ? old($key) : (app()->environment('local') ? $localValue : '');
|
||||
}
|
||||
|
||||
$name = getOldOrLocal('name', 'test3 normal user');
|
||||
$email = getOldOrLocal('email', 'test3@example.com');
|
||||
?>
|
||||
|
||||
<x-layout-simple>
|
||||
<section class="bg-gray-50 dark:bg-base">
|
||||
<div class="flex flex-col items-center justify-center px-6 py-8 mx-auto md:h-screen lg:py-0">
|
||||
@ -11,27 +21,16 @@
|
||||
</h1>
|
||||
<form action="/register" method="POST" class="flex flex-col gap-2">
|
||||
@csrf
|
||||
@env('local')
|
||||
<x-forms.input required value="test3 normal user" type="text" name="name"
|
||||
<x-forms.input id="name" required type="text" name="name" value="{{ $name }}"
|
||||
label="{{ __('input.name') }}" />
|
||||
<x-forms.input required value="test3@example.com" type="email" name="email"
|
||||
<x-forms.input id="email" required type="email" name="email" value="{{ $email }}"
|
||||
label="{{ __('input.email') }}" />
|
||||
<div class="flex gap-2">
|
||||
<x-forms.input required value="password" type="password" name="password"
|
||||
<x-forms.input id="password" required type="password" name="password"
|
||||
label="{{ __('input.password') }}" />
|
||||
<x-forms.input required value="password" type="password" name="password_confirmation"
|
||||
label="{{ __('input.password.again') }}" />
|
||||
<x-forms.input id="password_confirmation" required type="password"
|
||||
name="password_confirmation" label="{{ __('input.password.again') }}" />
|
||||
</div>
|
||||
@else
|
||||
<x-forms.input required type="text" name="name" label="{{ __('input.name') }}" />
|
||||
<x-forms.input required type="email" name="email" label="{{ __('input.email') }}" />
|
||||
<div class="flex gap-2">
|
||||
<x-forms.input required type="password" name="password"
|
||||
label="{{ __('input.password') }}" />
|
||||
<x-forms.input required type="password" name="password_confirmation"
|
||||
label="{{ __('input.password.again') }}" />
|
||||
</div>
|
||||
@endenv
|
||||
<x-forms.button class="mb-4" type="submit">Register</x-forms.button>
|
||||
<a href="/login" class="button bg-coollabs-gradient">
|
||||
{{ __('auth.already_registered') }}
|
||||
|
Loading…
Reference in New Issue
Block a user