enable registration

This commit is contained in:
Benjamin Takats
2022-11-30 23:26:27 +01:00
parent f12db8f4ad
commit b6d94132dc
5 changed files with 24 additions and 28 deletions

View File

@@ -23,12 +23,10 @@ class CreateNewUser implements CreatesNewUsers
*/ */
public function create(array $input) public function create(array $input)
{ {
abort('404', 'WIP');
Validator::make($input, [ Validator::make($input, [
'name' => ['required', 'string', 'max:255'], 'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => $this->passwordRules(), 'password' => app()->environment('local') ? 'required' : $this->passwordRules(),
'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '', 'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '',
]) ])
->validate(); ->validate();

View File

@@ -8,7 +8,6 @@ trait PasswordValidationRules
{ {
/** /**
* Get the validation rules used to validate passwords. * Get the validation rules used to validate passwords.
*
* @return array * @return array
*/ */
protected function passwordRules() protected function passwordRules()

View File

@@ -11,7 +11,7 @@ use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Jetstream\HasTeams; use Laravel\Jetstream\HasTeams;
use Laravel\Sanctum\HasApiTokens; use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable class User extends Authenticatable implements MustVerifyEmail
{ {
use HasApiTokens; use HasApiTokens;
use HasFactory; use HasFactory;
@@ -22,7 +22,6 @@ class User extends Authenticatable
/** /**
* The attributes that are mass assignable. * The attributes that are mass assignable.
*
* @var string[] * @var string[]
*/ */
protected $fillable = [ protected $fillable = [
@@ -31,7 +30,6 @@ class User extends Authenticatable
/** /**
* The attributes that should be hidden for serialization. * The attributes that should be hidden for serialization.
*
* @var array * @var array
*/ */
protected $hidden = [ protected $hidden = [
@@ -43,7 +41,6 @@ class User extends Authenticatable
/** /**
* The attributes that should be cast. * The attributes that should be cast.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
@@ -52,7 +49,6 @@ class User extends Authenticatable
/** /**
* The accessors to append to the model's array form. * The accessors to append to the model's array form.
*
* @var array * @var array
*/ */
protected $appends = [ protected $appends = [

View File

@@ -1,4 +1,4 @@
<div class="bg-21gray"> <div class="bg-21gray flex flex-col h-screen justify-between">
{{-- HEADER --}} {{-- HEADER --}}
<section class="w-full"> <section class="w-full">
<div class="max-w-7xl mx-auto px-10"> <div class="max-w-7xl mx-auto px-10">
@@ -115,7 +115,7 @@
</div> </div>
</section> </section>
{{-- FOOTER --}} {{-- FOOTER --}}
<section class="sticky bottom-0 py-10 bg-gray-900 w-full"> <div class="bottom-0 py-6 bg-gray-900 w-full">
<div class="px-10 mx-auto max-w-7xl"> <div class="px-10 mx-auto max-w-7xl">
<div class="flex flex-col items-center md:flex-row md:justify-between"> <div class="flex flex-col items-center md:flex-row md:justify-between">
<a href="#_"> <a href="#_">
@@ -147,5 +147,5 @@
</ul> </ul>
</div> </div>
</div> </div>
</section> </div>
</div> </div>

View File

@@ -22,13 +22,14 @@
photoPreview = e.target.result; photoPreview = e.target.result;
}; };
reader.readAsDataURL($refs.photo.files[0]); reader.readAsDataURL($refs.photo.files[0]);
" /> "/>
<x-jet-label for="photo" value="{{ __('Photo') }}" /> <x-jet-label for="photo" value="{{ __('Photo') }}"/>
<!-- Current Profile Photo --> <!-- Current Profile Photo -->
<div class="mt-2" x-show="! photoPreview"> <div class="mt-2" x-show="! photoPreview">
<img src="{{ $this->user->profile_photo_url }}" alt="{{ $this->user->name }}" class="rounded-full h-20 w-20 object-cover"> <img src="{{ $this->user->profile_photo_url }}" alt="{{ $this->user->name }}"
class="rounded-full h-20 w-20 object-cover">
</div> </div>
<!-- New Profile Photo Preview --> <!-- New Profile Photo Preview -->
@@ -48,28 +49,30 @@
</x-jet-secondary-button> </x-jet-secondary-button>
@endif @endif
<x-jet-input-error for="photo" class="mt-2" /> <x-jet-input-error for="photo" class="mt-2"/>
</div> </div>
@endif @endif
<!-- Name --> <!-- Name -->
<div class="col-span-6 sm:col-span-4"> <div class="col-span-6 sm:col-span-4">
<x-jet-label for="name" value="{{ __('Name') }}" /> <x-jet-label for="name" value="{{ __('Name') }}"/>
<x-jet-input id="name" type="text" class="mt-1 block w-full" wire:model.defer="state.name" autocomplete="name" /> <x-jet-input id="name" type="text" class="mt-1 block w-full" wire:model.defer="state.name"
<x-jet-input-error for="name" class="mt-2" /> autocomplete="name"/>
<x-jet-input-error for="name" class="mt-2"/>
</div> </div>
<!-- Email --> <!-- Email -->
<div class="col-span-6 sm:col-span-4"> <div class="col-span-6 sm:col-span-4">
<x-jet-label for="email" value="{{ __('Email') }}" /> <x-jet-label for="email" value="{{ __('Email') }}"/>
<x-jet-input id="email" type="email" class="mt-1 block w-full" wire:model.defer="state.email" /> <x-jet-input id="email" type="email" class="mt-1 block w-full" wire:model.defer="state.email"/>
<x-jet-input-error for="email" class="mt-2" /> <x-jet-input-error for="email" class="mt-2"/>
@if (Laravel\Fortify\Features::enabled(Laravel\Fortify\Features::emailVerification()) && ! $this->user->hasVerifiedEmail()) @if (Laravel\Fortify\Features::enabled(Laravel\Fortify\Features::emailVerification()) && ! $this->user->hasVerifiedEmail())
<p class="text-sm mt-2"> <p class="text-sm mt-2">
{{ __('Your email address is unverified.') }} {{ __('Your email address is unverified.') }}
<button type="button" class="underline text-sm text-gray-600 hover:text-gray-900" wire:click.prevent="sendEmailVerification"> <button type="button" class="underline text-sm text-gray-600 hover:text-gray-900"
wire:click.prevent="sendEmailVerification">
{{ __('Click here to re-send the verification email.') }} {{ __('Click here to re-send the verification email.') }}
</button> </button>
</p> </p>
@@ -88,8 +91,8 @@
{{ __('Saved.') }} {{ __('Saved.') }}
</x-jet-action-message> </x-jet-action-message>
{{--<x-jet-button wire:loading.attr="disabled" wire:target="photo"> <x-jet-button wire:loading.attr="disabled" wire:target="photo">
{{ __('Save') }} {{ __('Save') }}
</x-jet-button>--}} </x-jet-button>
</x-slot> </x-slot>
</x-jet-form-section> </x-jet-form-section>