Skip to content

Commit

Permalink
use spatie/html for register form
Browse files Browse the repository at this point in the history
  • Loading branch information
fey committed Mar 12, 2024
1 parent aabcabf commit f82aa2d
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 62 deletions.
8 changes: 0 additions & 8 deletions resources/lang/en/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@
'sicp_book' => 'The book',
'logo_alt' => 'Hexlet SICP',
],
'login' => [
'form_header' => 'Login',
'remember_me' => 'Remember Me',
'password' => 'Password',
'button' => 'Login',
'email' => 'E-mail',
'reset_password' => 'Forgot Your Password?',
],
'welcome' => [
'start_learning' => 'Start learning',
],
Expand Down
11 changes: 11 additions & 0 deletions resources/lang/en/login.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

return [
'title' => 'Login',
'remember_me' => 'Remember Me',
'password' => 'Password',
'submit' => 'Login',
'email' => 'E-mail',
'reset_password' => 'Forgot Your Password?',
'register' => 'Sign up'
];
14 changes: 6 additions & 8 deletions resources/lang/en/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

return [
'title' => 'Registration',
'emailPlaceholder' => 'Email',
'namePlaceholder' => 'Name',
'passwordPlaceholder' => 'Password',
'passwordConfirmationPlaceholder' => 'Confirm password',
'registerButton' => 'Sign up',
'accountExists' => 'Already have an account?',
'logIn' => 'Log in',
'or' => 'or',
'email' => 'Email',
'name' => 'Name',
'password' => 'Password',
'password_confirmation' => 'Confirm password',
'submit' => 'Sign up',
'login' => 'Log in',
];
8 changes: 0 additions & 8 deletions resources/lang/ru/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@
'sicp_book' => 'Книга',
'logo_alt' => 'Хекслет СИКП',
],
'login' => [
'form_header' => 'Войти',
'remember_me' => 'Запомнить меня',
'email' => 'Электронная почта',
'password' => 'Пароль',
'reset_password' => 'Забыли пароль?',
'button' => 'Войти',
],
'welcome' => [
'start_learning' => 'Начать учиться',
],
Expand Down
11 changes: 11 additions & 0 deletions resources/lang/ru/login.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

return [
'title' => 'Войти',
'remember_me' => 'Запомнить меня',
'email' => 'Электронная почта',
'password' => 'Пароль',
'reset_password' => 'Забыли пароль?',
'submit' => 'Войти',
'register' => 'Зарегистрироваться'
];
14 changes: 6 additions & 8 deletions resources/lang/ru/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

return [
'title' => 'Регистрация',
'namePlaceholder' => 'Имя',
'emailPlaceholder' => 'Электронная почта',
'passwordPlaceholder' => 'Пароль',
'passwordConfirmationPlaceholder' => 'Подтверждение пароля',
'registerButton' => 'Зарегистрироваться',
'accountExists' => 'Уже есть аккаунт?',
'logIn' => 'Войти',
'or' => 'или',
'name' => 'Имя',
'email' => 'Электронная почта',
'password' => 'Пароль',
'password_confirmation' => 'Подтверждение пароля',
'submit' => 'Зарегистрироваться',
'login' => 'Войти',
];
17 changes: 8 additions & 9 deletions resources/views/auth/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,34 @@
<div class="col-md-5 mx-auto">
<div class="card">
<h1 class="h4 text-center card-header p-3">
{{ __('layout.login.form_header') }}
{{ __('login.title') }}
</h1>
<div class="card-body">
{{ html()->form('POST', route('login'))->open() }}
<div class="mb-3">
{{ html()->label(__('layout.login.email'))->for('email')->class('form-label') }}
{{ html()->label(__('login.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()->label(__('layout.login.password'))->for('password')->class('form-label') }}
{{ html()->label(__('login.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 form-check">
{{ html()->checkbox('remember')->class('form-check-input') }}
{{ html()->label(__('layout.login.remember_me'))->for('remember')->class('form-label') }}
{{ html()->label(__('login.remember_me'))->for('remember')->class('form-label') }}
</div>
{{ html()->submit(__('layout.login.button'))->class('btn btn-primary btn-block') }}
<a class="mt-2 d-block" href="{{ route('password.request') }}">{{ __('layout.login.reset_password') }}</a>
{{ html()->submit(__('login.submit'))->class('btn btn-primary btn-block') }}
<a class="mt-2 d-block" href="{{ route('register') }}">{{ __('login.register') }}</a>
<a class="mt-2 d-block" href="{{ route('password.request') }}">{{ __('login.reset_password') }}</a>
<a href="{{ route('oauth.github') }}" class="mt-2 d-block"> {{ __('auth.with_github') }}</a>
{{ html()->form()->close() }}
</div>
<div class="card-footer p-4 text-center bg-transparent">
@include('components.social_login')
</div>
</div>
</div>
</div>
Expand Down
56 changes: 39 additions & 17 deletions resources/views/auth/register.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,46 @@
{{ __('register.title') }}
</h1>
<div class="card-body">
{{ BsForm::open(route('register')) }}
{{ BsForm::email('email')->label(__('register.emailPlaceholder')) }}
{{ BsForm::text('name')->label(__('register.namePlaceholder')) }}
{{ BsForm::password('password')->label(__('register.passwordPlaceholder')) }}
{{ BsForm::password('password_confirmation')->label(__('register.passwordConfirmationPlaceholder')) }}
<div class="mt-4">
{{ BsForm::submit(__('register.registerButton'))->attribute('class', 'btn btn-primary btn-block') }}
<div class="mt-2">
<a href="{{ route('login') }}">
{{ __('register.accountExists') }}
{{ __('register.logIn') }}
</a>
</div>
<div class="mb-3">
{{ html()->form('POST', 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>
{{ BsForm::close() }}
</div>
<div class="card-footer p-2 text-center bg-transparent">
@include('components.social_login')
<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')
<span class="invalid-feedback">{{ $errors->first('password_confirmation') }}</span>
@enderror
</div>
<div class="mb-3">
{{ html()->submit(__('register.submit'))->class('btn btn-primary btn-block') }}
</div>
<div class="mt-2">
<a href="{{ route('login') }}">{{ __('register.login') }}</a>
<a href="{{ route('oauth.github') }}" class="mt-2 d-block"> {{ __('auth.with_github') }}</a>
</div>
{{ html()->form()->close() }}
</div>
</div>
</div>
Expand Down
4 changes: 0 additions & 4 deletions resources/views/components/social_login.blade.php

This file was deleted.

0 comments on commit f82aa2d

Please sign in to comment.