Skip to content

Commit

Permalink
use spatie/html
Browse files Browse the repository at this point in the history
  • Loading branch information
fey committed Mar 13, 2024
1 parent f82aa2d commit abf4212
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 25 deletions.
1 change: 1 addition & 0 deletions resources/lang/en/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
'password_confirmation' => 'Confirm password',
'submit' => 'Sign up',
'login' => 'Log in',
'reset_password' => 'Forgot Your Password?',
];
1 change: 1 addition & 0 deletions resources/lang/ru/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
'password_confirmation' => 'Подтверждение пароля',
'submit' => 'Зарегистрироваться',
'login' => 'Войти',
'reset_password' => 'Забыли пароль?',
];
2 changes: 1 addition & 1 deletion resources/views/auth/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{ __('login.title') }}
</h1>
<div class="card-body">
{{ html()->form('POST', route('login'))->open() }}
{{ html()->form()->route('login')->open() }}
<div class="mb-3">
{{ html()->label(__('login.email'))->for('email')->class('form-label') }}
{{ html()->email('email')->class(['form-control', 'is-invalid' => $errors->has('email')]) }}
Expand Down
22 changes: 14 additions & 8 deletions resources/views/auth/passwords/email.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,26 @@
{{ __('passwords.reset_password.form_header') }}
</h1>
<div class="card-body mb-3">
@if($errors->any())
<div class="alert alert-danger" role="alert">
{{ $errors->first() }}
</div>
@endif
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif

{{ BsForm::open(route('password.email')) }}
{{ BsForm::text('email')->label(__('passwords.reset_password.email')) }}

<div class="mt-4">
{{ BsForm::submit(__('passwords.reset_password.button_send_link'))->attribute('class', 'btn btn-primary btn-block') }}
{{ html()->form()->action(route('password.email'))->open() }}
<div class="mb-3">
{{ html()->label(__(__('passwords.reset_password.email')))->for('email')->class('form-label') }}
{{ html()->email('email')->class(['form-control', 'is-invalid' => $errors->has('email')]) }}
@error('email')
<span class="invalid-feedback">{{ $errors->first('email') }}</span>
@enderror
</div>

{{ BsForm::close() }}
{{ html()->submit(__('passwords.reset_password.button_send_link'))->class('btn btn-primary btn-block') }}
{{ html()->form()->close() }}
</div>
</div>
</div>
Expand Down
37 changes: 26 additions & 11 deletions resources/views/auth/passwords/reset.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,34 @@
<h1 class="h4 text-center card-header p-3">
{{ __('passwords.reset_password.form_header') }}
</h1>
<div class="card-body mb-3">
{{ BsForm::open(route('password.update')) }}
{{ Form::hidden('token', $token) }}
{{ BsForm::text('email', $email ?? old('email'))->label(__('passwords.reset_password.email')) }}
<div class="card-body">

{{ BsForm::password('password')->label(__('passwords.reset_password.password')) }}
{{ BsForm::password('password_confirmation')->label(__('passwords.reset_password.confirm_password')) }}

<div class="mt-4">
{{ BsForm::submit(__('passwords.reset_password.button'))->attribute('class', 'btn btn-primary btn-block') }}
{{ html()->form()->action(route('password.update'))->open() }}
{{ html()->hidden('token')->value($token )}}
<div class="mb-3">
{{ html()->label(__(__('passwords.reset_password.email')))->for('email')->class('form-label') }}
{{ html()->email('email')->class(['form-control', 'is-invalid' => $errors->has('email')]) }}
@error('email')
<span class="invalid-feedback">{{ $errors->first('email') }}</span>
@enderror
</div>

{{ BsForm::close() }}
<div class="mb-3">
{{ html()->label(__('passwords.reset_password.password'))->for('password')->class('form-label') }}
{{ html()->password('password')->class(['form-control', 'is-invalid' => $errors->has('password')]) }} @error('password')
<span class="invalid-feedback">{{ $errors->first('password') }}</span>
@enderror
</div>
<div class="mb-3">
{{ html()->label(__('passwords.reset_password.confirm_password'))->for('password')->class('form-label') }}
{{ html()->password('password_confirmation')->class(['form-control', 'is-invalid' => $errors->has('password_confirmation')]) }}
@error('password_confirmation')
<span class="invalid-feedback">{{ $errors->first('password_confirmation') }}</span>
@enderror
</div>
<div class="mb-3">
{{ html()->submit(__('passwords.reset_password.button'))->class('btn btn-primary btn-block') }}
</div>
{{ html()->form()->close() }}
</div>
</div>
</div>
Expand Down
8 changes: 3 additions & 5 deletions resources/views/auth/register.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,33 @@
<div class="row">
<div class="col-md-5 mx-auto">
<div class="card">
<h1 class="h43text-center card-header p-3">
<h1 class="h4 text-center card-header p-3">
{{ __('register.title') }}
</h1>
<div class="card-body">
<div class="mb-3">
{{ html()->form('POST', route('register'))->open() }}
{{ html()->form()->route('register')->open() }}
{{ html()->label(__('register.email'))->for('email')->class('form-label') }}
{{ html()->email('email')->class(['form-control', 'is-invalid' => $errors->has('email')]) }}
@error('email')
<span class="invalid-feedback">{{ $errors->first('email') }}</span>
@enderror
</div>
<div class="mb-3">
{{ html()->form('POST', route('register'))->open() }}
{{ html()->label(__('register.name'))->for('email')->class('form-label') }}
{{ html()->text('name')->class(['form-control', 'is-invalid' => $errors->has('name')]) }}
@error('name')
<span class="invalid-feedback">{{ $errors->first('name') }}</span>
@enderror
</div>
<div class="mb-3">
{{ html()->form('POST', route('register'))->open() }}
{{ html()->label(__('register.password'))->for('password')->class('form-label') }}
{{ html()->password('password')->class(['form-control', 'is-invalid' => $errors->has('password')]) }}
@error('password')
<span class="invalid-feedback">{{ $errors->first('password') }}</span>
@enderror
</div>
<div class="mb-3">
{{ html()->form('POST', route('register'))->open() }}
{{ html()->label(__('register.password_confirmation'))->for('password')->class('form-label') }}
{{ html()->password('password_confirmation')->class(['form-control', 'is-invalid' => $errors->has('password_confirmation')]) }}
@error('password_confirmation')
Expand All @@ -45,6 +42,7 @@
</div>
<div class="mt-2">
<a href="{{ route('login') }}">{{ __('register.login') }}</a>
<a class="mt-2 d-block" href="{{ route('password.request') }}">{{ __('register.reset_password') }}</a>
<a href="{{ route('oauth.github') }}" class="mt-2 d-block"> {{ __('auth.with_github') }}</a>
</div>
{{ html()->form()->close() }}
Expand Down

0 comments on commit abf4212

Please sign in to comment.