#9: Improved the look of the login and register pages, and updated to Bootstrap v4

This commit is contained in:
Andy Heathershaw 2017-03-23 04:29:29 +00:00
parent df96a9093c
commit dda9f9cbdb
8 changed files with 182 additions and 173 deletions

View File

@ -28,7 +28,15 @@ class RecaptchaHelper
if (is_null($return))
{
throw new \Exception('Error while communicating with the reCAPTCHA service.');
$message = 'Error while communicating with the reCAPTCHA service.';
$curlError = curl_error($ch);
if (strlen($curlError) > 0)
{
$message .= ' ' . $curlError;
}
throw new \Exception($message);
}
return $return->success;

View File

@ -56,7 +56,8 @@ class LoginController extends Controller
*/
public function showLoginForm(Request $request)
{
return Theme::render('auth.login', [
return Theme::render('auth.v2_unified', [
'active_tab' => 'login',
'info' => $request->session()->get('info')
]);
}

View File

@ -144,6 +144,8 @@ class RegisterController extends Controller
return redirect(route('home'));
}
return Theme::render('auth.register');
return Theme::render('auth.v2_unified', [
'active_tab' => 'register'
]);
}
}

View File

@ -1,65 +0,0 @@
@extends('themes.base.layout')
@section('title', trans('auth.login_page_title'))
@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">@yield('title')</div>
<div class="panel-body">
<form class="form-horizontal" role="form" method="POST" action="{{ url('/login') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">@lang('forms.email_label')</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" autofocus>
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password" class="col-md-4 control-label">@lang('forms.password_label')</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password">
@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<div class="checkbox">
<label>
<input type="checkbox" name="remember"> @lang('forms.remember_me_label')
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4 text-right">
<a class="btn btn-link" href="{{ url('/password/reset') }}">@lang('auth.forgot_password_link')</a>
<button type="submit" class="btn btn-success">@lang('forms.login_action')</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -1,105 +0,0 @@
@extends('themes.base.layout')
@section('title', trans('auth.register_page_title'))
@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">@yield('title')</div>
<div class="panel-body">
<form class="form-horizontal" role="form" method="POST" action="{{ url('/register') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="col-md-4 control-label">@lang('forms.realname_label')</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control" name="name" value="{{ old('name') }}" autofocus>
@if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">@lang('forms.email_label')</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}">
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password" class="col-md-4 control-label">@lang('forms.password_label')</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password">
@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
<label for="password-confirm" class="col-md-4 control-label">@lang('forms.password_confirm_label')</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation">
@if ($errors->has('password_confirmation'))
<span class="help-block">
<strong>{{ $errors->first('password_confirmation') }}</strong>
</span>
@endif
</div>
</div>
@if (UserConfig::get('recaptcha_enabled_registration'))
<div class="form-group">
@if ($errors->has('recaptcha'))
<div class="col-md-12">
<div class="alert alert-danger">
<i class="fa fa-fw fa-warning"></i>
{{ $errors->first('recaptcha') }}
</div>
</div>
@endif
<div class="col-md-6 col-md-offset-4">
<div class="g-recaptcha" data-sitekey="{{ UserConfig::get('recaptcha_site_key') }}"></div>
</div>
</div>
@endif
<div class="form-group">
<div class="col-md-6 col-md-offset-4 text-right">
<a href="{{ route('home') }}" class="btn btn-default">@lang('forms.cancel_action')</a>
<button type="submit" class="btn btn-success">@lang('forms.register_action')</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
@if (UserConfig::get('recaptcha_enabled_registration'))
@push('scripts')
<script src="https://www.google.com/recaptcha/api.js"></script>
@endpush
@endif

View File

@ -0,0 +1,30 @@
@extends('themes.base.layout')
@section('title', trans($active_tab == 'login' ? 'auth.login_page_title' : 'auth.register_page_title'))
@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 offset-md-2">
<div class="card">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs">
<li class="nav-item">
<a class="nav-link{{ $active_tab == 'login' ? ' active' : '' }}" href="{{ url('/login') }}">@lang('auth.login_page_title')</a>
</li>
<li class="nav-item">
<a class="nav-link{{ $active_tab == 'register' ? ' active' : '' }}" href="{{ url('/register') }}">@lang('auth.register_page_title')</a>
</li>
</ul>
</div>
<div class="card-block">
@if ($active_tab == 'login')
@include(Theme::viewName('partials.login'))
@elseif ($active_tab == 'register')
@include(Theme::viewName('partials.register'))
@endif
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,49 @@
<form role="form" method="POST" action="{{ url('/login') }}">
{{ csrf_field() }}
<div class="form-group row{{ $errors->has('email') ? ' has-danger' : '' }}">
<label for="email" class="col-md-4 col-form-label text-md-right">@lang('forms.email_label')</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" autofocus>
@if ($errors->has('email'))
<div class="form-control-feedback">
<strong>{{ $errors->first('email') }}</strong>
</div>
@endif
</div>
</div>
<div class="form-group row{{ $errors->has('password') ? ' has-danger' : '' }}">
<label for="password" class="col-md-4 col-form-label text-md-right">@lang('forms.password_label')</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password">
@if ($errors->has('password'))
<div class="form-control-feedback">
<strong>{{ $errors->first('password') }}</strong>
</div>
@endif
</div>
</div>
<div class="form-group row">
<div class="col-md-6 offset-md-4">
<div class="form-check">
<label class="form-check-label">
<input class="form-check-input" type="checkbox" name="remember"> @lang('forms.remember_me_label')
</label>
</div>
</div>
</div>
<div class="form-group row">
<div class="col-md-6 offset-md-4 text-right">
<a class="btn btn-link" href="{{ url('/password/reset') }}">@lang('auth.forgot_password_link')</a>
<button type="submit" class="btn btn-success"><i class="fa fa-fw fa-check"></i> @lang('forms.login_action')</button>
</div>
</div>
</form>

View File

@ -0,0 +1,89 @@
<form role="form" method="POST" action="{{ url('/register') }}">
{{ csrf_field() }}
<div class="form-group row{{ $errors->has('name') ? ' has-danger' : '' }}">
<label for="name" class="col-md-4 col-form-label text-md-right">@lang('forms.realname_label')</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control" name="name" value="{{ old('name') }}" autofocus>
@if ($errors->has('name'))
<div class="form-control-feedback">
<strong>{{ $errors->first('name') }}</strong>
</div>
@endif
</div>
</div>
<div class="form-group row{{ $errors->has('email') ? ' has-danger' : '' }}">
<label for="email" class="col-md-4 col-form-label text-md-right">@lang('forms.email_label')</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}">
@if ($errors->has('email'))
<div class="form-control-feedback">
<strong>{{ $errors->first('email') }}</strong>
</div>
@endif
</div>
</div>
<div class="form-group row{{ $errors->has('password') ? ' has-danger' : '' }}">
<label for="password" class="col-md-4 col-form-label text-md-right">@lang('forms.password_label')</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password">
@if ($errors->has('password'))
<div class="form-control-feedback">
<strong>{{ $errors->first('password') }}</strong>
</div>
@endif
</div>
</div>
<div class="form-group row{{ $errors->has('password_confirmation') ? ' has-danger' : '' }}">
<label for="password-confirm" class="col-md-4 col-form-label text-md-right">@lang('forms.password_confirm_label')</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation">
@if ($errors->has('password_confirmation'))
<div class="form-control-feedback">
<strong>{{ $errors->first('password_confirmation') }}</strong>
</div>
@endif
</div>
</div>
@if (UserConfig::get('recaptcha_enabled_registration'))
<div class="form-group row">
@if ($errors->has('recaptcha'))
<div class="col-md-12">
<div class="alert alert-danger">
<i class="fa fa-fw fa-warning"></i>
{{ $errors->first('recaptcha') }}
</div>
</div>
@endif
<div class="col-md-6 offset-md-4">
<div class="g-recaptcha" data-sitekey="{{ UserConfig::get('recaptcha_site_key') }}"></div>
</div>
</div>
@endif
<div class="form-group row">
<div class="col-md-6 offset-md-4 text-right">
<a href="{{ route('home') }}" class="btn btn-link">@lang('forms.cancel_action')</a>
<button type="submit" class="btn btn-success"><i class="fa fa-fw fa-check"></i> @lang('forms.register_action')</button>
</div>
</div>
</form>
@if (UserConfig::get('recaptcha_enabled_registration'))
@push('scripts')
<script src="https://www.google.com/recaptcha/api.js"></script>
@endpush
@endif