#9, #11: Forgot/reset password screens updated to Bootstrap v4. Added confirmation messages to reset password flow. Corrected the text of the "test e-mail" function and localised the strings used.

This commit is contained in:
Andy Heathershaw 2017-04-10 20:48:47 +01:00
parent ce1c82b275
commit 2c7dba6728
10 changed files with 98 additions and 78 deletions

View File

@ -196,7 +196,7 @@ class DefaultController extends Controller
Mail::to(Auth::user())->send(new TestMailConfig($config['sender_name'], $config['sender_address'])); Mail::to(Auth::user())->send(new TestMailConfig($config['sender_name'], $config['sender_address']));
return response()->json(array('is_successful' => true, 'message' => 'sent_successfully')); return response()->json(array('is_successful' => true, 'message' => trans('admin.settings_test_email_successful')));
} }
catch (\Exception $ex) catch (\Exception $ex)
{ {

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers\Auth;
use App\Facade\Theme; use App\Facade\Theme;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails; use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Http\Request;
class ForgotPasswordController extends Controller class ForgotPasswordController extends Controller
{ {
@ -36,8 +37,10 @@ class ForgotPasswordController extends Controller
* *
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function showLinkRequestForm() public function showLinkRequestForm(Request $request)
{ {
return Theme::render('auth.passwords.email'); $resetStatus = $request->session()->get('status');
return Theme::render('auth.passwords.email', ['success' => $resetStatus]);
} }
} }

View File

@ -50,8 +50,9 @@ class ResetPasswordController extends Controller
*/ */
public function showResetForm(Request $request, $token = null) public function showResetForm(Request $request, $token = null)
{ {
return Theme::render('auth.passwords.reset')->with( return Theme::render('auth.passwords.reset', [
['token' => $token, 'email' => $request->email] 'token' => $token,
); 'email' => $request->email
]);
} }
} }

View File

@ -15,10 +15,12 @@ class DefaultController extends Controller
public function index(Request $request) public function index(Request $request)
{ {
$albums = DbHelper::getAlbumsForCurrentUser(); $albums = DbHelper::getAlbumsForCurrentUser();
$resetStatus = $request->session()->get('status');
return Theme::render('gallery.index', [ return Theme::render('gallery.index', [
'albums' => $albums, 'albums' => $albums,
'info' => $request->session()->get('info') 'info' => $request->session()->get('info'),
'success' => $resetStatus
]); ]);
} }
} }

View File

@ -137,6 +137,9 @@ return [
'settings_save_action' => 'Update Settings', 'settings_save_action' => 'Update Settings',
'settings_saved_message' => 'The settings were updated successfully.', 'settings_saved_message' => 'The settings were updated successfully.',
'settings_test_email_action' => 'Send a test e-mail', 'settings_test_email_action' => 'Send a test e-mail',
'settings_test_email_summary_failed' => 'Failed!',
'settings_test_email_summary_successful' => 'Successful!',
'settings_test_email_successful' => 'A test e-mail was submitted to your mail server successfully.',
'settings_title' => 'Settings', 'settings_title' => 'Settings',
'stats_widget' => [ 'stats_widget' => [
'albums' => 'album|albums', 'albums' => 'album|albums',

View File

@ -20,9 +20,12 @@ return [
'and password you provided when you registered.', 'and password you provided when you registered.',
'activation_required_message' => 'An e-mail containing an activation link has been sent to the e-mail address you provided. ' . 'activation_required_message' => 'An e-mail containing an activation link has been sent to the e-mail address you provided. ' .
'Please click the link in this e-mail to activate your account.', 'Please click the link in this e-mail to activate your account.',
'forgot_password_action' => 'Send Reset E-mail',
'forgot_password_link' => 'Forgotten your password?', 'forgot_password_link' => 'Forgotten your password?',
'forgot_password_title' => 'Send password reset link', 'forgot_password_title' => 'Send password reset link',
'login_page_title' => 'Login', 'login_page_title' => 'Login',
'recaptcha_failed_message' => 'The reCAPTCHA verfication failed. Please ensure you have completed the reCAPTCHA challenge and try again.', 'recaptcha_failed_message' => 'The reCAPTCHA verfication failed. Please ensure you have completed the reCAPTCHA challenge and try again.',
'register_page_title' => 'Create an account' 'register_page_title' => 'Create an account',
'reset_password_action' => 'Reset Password',
'reset_password_title' => 'Reset your password'
]; ];

View File

@ -15,7 +15,7 @@ return [
'password' => 'Passwords must be at least six characters and match the confirmation.', 'password' => 'Passwords must be at least six characters and match the confirmation.',
'reset' => 'Your password has been reset!', 'reset' => 'Your password has been reset!',
'sent' => 'We have e-mailed your password reset link!', 'sent' => 'We have sent your password reset link to your e-mail address.',
'token' => 'This password reset token is invalid.', 'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that e-mail address.", 'user' => "We can't find a user with that e-mail address.",

View File

@ -189,7 +189,8 @@
</div> </div>
<div class="alert" id="test-email-result" style="display: none;"> <div class="alert" id="test-email-result" style="display: none;">
<p><strong id="test-email-result-summary"></strong> <span id="test-email-result-message"></span></p> <i class="fa fa-fw fa-info-circle"></i>
<strong id="test-email-result-summary"></strong> <span id="test-email-result-message"></span>
</div> </div>
</div> </div>
</div> </div>
@ -295,12 +296,12 @@
if (data.is_successful) if (data.is_successful)
{ {
$('#test-email-result').addClass('alert-success'); $('#test-email-result').addClass('alert-success');
$('#test-email-result-summary').html('Successful'); $('#test-email-result-summary').html('@lang('admin.settings_test_email_summary_successful')');
} }
else else
{ {
$('#test-email-result').addClass('alert-danger'); $('#test-email-result').addClass('alert-danger');
$('#test-email-result-summary').html('Failed'); $('#test-email-result-summary').html('@lang('admin.settings_test_email_summary_failed')');
} }
$('#test-email-result-message').html(data.message); $('#test-email-result-message').html(data.message);

View File

@ -4,37 +4,38 @@
@section('content') @section('content')
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-md-8 col-md-offset-2"> <div class="col-md-8 offset-md-2">
<div class="panel panel-default"> <div class="card">
<div class="panel-heading">@yield('title')</div> <div class="card-header">
<div class="panel-body"> <ul class="nav nav-tabs card-header-tabs">
@if (session('status')) <li class="nav-item">
<div class="alert alert-success"> <a class="nav-link active" href="{{ url('/password/reset') }}">@yield('title')</a>
{{ session('status') }} </li>
</div> </ul>
@endif </div>
<div class="card-block">
<form class="form-horizontal" role="form" method="POST" action="{{ url('/password/email') }}"> <form role="form" method="POST" action="{{ url('/password/email') }}">
{{ csrf_field() }} {{ csrf_field() }}
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}"> <div class="form-group row{{ $errors->has('email') ? ' has-danger' : '' }}">
<label for="email" class="col-md-4 control-label">@lang('forms.email_label')</label> <label for="email" class="col-md-4 col-form-label text-md-right">@lang('forms.email_label')</label>
<div class="col-md-6"> <div class="col-md-6">
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}"> <input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}">
@if ($errors->has('email')) @if ($errors->has('email'))
<span class="help-block"> <div class="form-control-feedback">
<strong>{{ $errors->first('email') }}</strong> <strong>{{ $errors->first('email') }}</strong>
</span> </div>
@endif @endif
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group row">
<div class="col-md-6 col-md-offset-4 text-right"> <div class="col-md-6 offset-md-4 text-right">
<a href="{{ url('/login') }}" class="btn btn-link">@lang('forms.cancel_action')</a>
<button type="submit" class="btn btn-success"> <button type="submit" class="btn btn-success">
Send Password Reset Link <i class="fa fa-fw fa-check"></i> @lang('auth.forgot_password_action')
</button> </button>
</div> </div>
</div> </div>

View File

@ -2,70 +2,76 @@
@section('title', trans('auth.reset_password_title')) @section('title', trans('auth.reset_password_title'))
@section('content') @section('content')
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-md-8 col-md-offset-2"> <div class="col-md-8 offset-md-2">
<div class="panel panel-default"> <div class="card">
<div class="panel-heading">@yield('title')</div> <div class="card-header">
<ul class="nav nav-tabs card-header-tabs">
<li class="nav-item">
<a class="nav-link active" href="{{ url('/password/reset') }}">@yield('title')</a>
</li>
</ul>
</div>
<div class="card-block">
<form role="form" method="POST" action="{{ url('/password/reset') }}">
{{ csrf_field() }}
<div class="panel-body"> <input type="hidden" name="token" value="{{ $token }}">
<form class="form-horizontal" role="form" method="POST" action="{{ url('/password/reset') }}">
{{ csrf_field() }}
<input type="hidden" name="token" value="{{ $token }}"> <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="form-group{{ $errors->has('email') ? ' has-error' : '' }}"> <div class="col-md-6">
<label for="email" class="col-md-4 control-label">@lang('forms.email_label')</label> <input id="email" type="email" class="form-control" name="email" value="{{ $email or old('email') }}" autofocus>
<div class="col-md-6"> @if ($errors->has('email'))
<input id="email" type="email" class="form-control" name="email" value="{{ $email or old('email') }}" autofocus> <div class="form-control-feedback">
<strong>{{ $errors->first('email') }}</strong>
@if ($errors->has('email')) </div>
<span class="help-block"> @endif
<strong>{{ $errors->first('email') }}</strong> </div>
</span>
@endif
</div> </div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}"> <div class="form-group row{{ $errors->has('password') ? ' has-danger' : '' }}">
<label for="password" class="col-md-4 control-label">Password</label> <label for="password" class="col-md-4 col-form-label text-md-right">@lang('forms.password_label')</label>
<div class="col-md-6"> <div class="col-md-6">
<input id="password" type="password" class="form-control" name="password"> <input id="password" type="password" class="form-control" name="password">
@if ($errors->has('password')) @if ($errors->has('password'))
<span class="help-block"> <div class="form-control-feedback">
<strong>{{ $errors->first('password') }}</strong> <strong>{{ $errors->first('password') }}</strong>
</span> </div>
@endif @endif
</div>
</div> </div>
</div>
<div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}"> <div class="form-group row{{ $errors->has('password_confirmation') ? ' has-danger' : '' }}">
<label for="password-confirm" class="col-md-4 control-label">Confirm Password</label> <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"> <div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation"> <input id="password-confirm" type="password" class="form-control" name="password_confirmation">
@if ($errors->has('password_confirmation')) @if ($errors->has('password_confirmation'))
<span class="help-block"> <div class="form-control-feedback">
<strong>{{ $errors->first('password_confirmation') }}</strong> <strong>{{ $errors->first('password_confirmation') }}</strong>
</span> </div>
@endif @endif
</div>
</div> </div>
</div>
<div class="form-group"> <div class="form-group row">
<div class="col-md-6 col-md-offset-4"> <div class="col-md-6 offset-md-4 text-right">
<button type="submit" class="btn btn-primary"> <a href="{{ url('/login') }}" class="btn btn-link">@lang('forms.cancel_action')</a>
Reset Password <button type="submit" class="btn btn-success">
</button> <i class="fa fa-fw fa-check"></i> @lang('auth.reset_password_action')
</button>
</div>
</div> </div>
</div> </form>
</form> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
@endsection @endsection