From 2c7dba6728f392ee1c69e83da3c5c2987a2460d9 Mon Sep 17 00:00:00 2001 From: Andy Heathershaw Date: Mon, 10 Apr 2017 20:48:47 +0100 Subject: [PATCH] #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. --- .../Controllers/Admin/DefaultController.php | 2 +- .../Auth/ForgotPasswordController.php | 7 +- .../Auth/ResetPasswordController.php | 7 +- .../Controllers/Gallery/DefaultController.php | 4 +- resources/lang/en/admin.php | 3 + resources/lang/en/auth.php | 5 +- resources/lang/en/passwords.php | 2 +- .../themes/base/admin/settings.blade.php | 7 +- .../base/auth/passwords/email.blade.php | 37 +++---- .../base/auth/passwords/reset.blade.php | 102 +++++++++--------- 10 files changed, 98 insertions(+), 78 deletions(-) diff --git a/app/Http/Controllers/Admin/DefaultController.php b/app/Http/Controllers/Admin/DefaultController.php index 521c3c8..fcbfb32 100644 --- a/app/Http/Controllers/Admin/DefaultController.php +++ b/app/Http/Controllers/Admin/DefaultController.php @@ -196,7 +196,7 @@ class DefaultController extends Controller 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) { diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index 829b712..03711ee 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Auth; use App\Facade\Theme; use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\SendsPasswordResetEmails; +use Illuminate\Http\Request; class ForgotPasswordController extends Controller { @@ -36,8 +37,10 @@ class ForgotPasswordController extends Controller * * @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]); } } diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index 03d9fae..b03e602 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -50,8 +50,9 @@ class ResetPasswordController extends Controller */ public function showResetForm(Request $request, $token = null) { - return Theme::render('auth.passwords.reset')->with( - ['token' => $token, 'email' => $request->email] - ); + return Theme::render('auth.passwords.reset', [ + 'token' => $token, + 'email' => $request->email + ]); } } diff --git a/app/Http/Controllers/Gallery/DefaultController.php b/app/Http/Controllers/Gallery/DefaultController.php index 22057b2..c2a0ca8 100644 --- a/app/Http/Controllers/Gallery/DefaultController.php +++ b/app/Http/Controllers/Gallery/DefaultController.php @@ -15,10 +15,12 @@ class DefaultController extends Controller public function index(Request $request) { $albums = DbHelper::getAlbumsForCurrentUser(); + $resetStatus = $request->session()->get('status'); return Theme::render('gallery.index', [ 'albums' => $albums, - 'info' => $request->session()->get('info') + 'info' => $request->session()->get('info'), + 'success' => $resetStatus ]); } } \ No newline at end of file diff --git a/resources/lang/en/admin.php b/resources/lang/en/admin.php index 81d444d..229eeca 100644 --- a/resources/lang/en/admin.php +++ b/resources/lang/en/admin.php @@ -137,6 +137,9 @@ return [ 'settings_save_action' => 'Update Settings', 'settings_saved_message' => 'The settings were updated successfully.', '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', 'stats_widget' => [ 'albums' => 'album|albums', diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php index 594fa60..de97503 100644 --- a/resources/lang/en/auth.php +++ b/resources/lang/en/auth.php @@ -20,9 +20,12 @@ return [ '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. ' . '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_title' => 'Send password reset link', 'login_page_title' => 'Login', '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' ]; diff --git a/resources/lang/en/passwords.php b/resources/lang/en/passwords.php index e5544d2..7e193a7 100644 --- a/resources/lang/en/passwords.php +++ b/resources/lang/en/passwords.php @@ -15,7 +15,7 @@ return [ 'password' => 'Passwords must be at least six characters and match the confirmation.', '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.', 'user' => "We can't find a user with that e-mail address.", diff --git a/resources/views/themes/base/admin/settings.blade.php b/resources/views/themes/base/admin/settings.blade.php index f8ad169..79d08c0 100644 --- a/resources/views/themes/base/admin/settings.blade.php +++ b/resources/views/themes/base/admin/settings.blade.php @@ -189,7 +189,8 @@ @@ -295,12 +296,12 @@ if (data.is_successful) { $('#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 { $('#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); diff --git a/resources/views/themes/base/auth/passwords/email.blade.php b/resources/views/themes/base/auth/passwords/email.blade.php index a7c8c5b..c4ddaef 100644 --- a/resources/views/themes/base/auth/passwords/email.blade.php +++ b/resources/views/themes/base/auth/passwords/email.blade.php @@ -4,37 +4,38 @@ @section('content')
-
-
-
@yield('title')
-
- @if (session('status')) -
- {{ session('status') }} -
- @endif - -
+
+
+
+ +
+
+ {{ csrf_field() }} -
- +
+
@if ($errors->has('email')) - + @endif
-
-
+
+
+ @lang('forms.cancel_action')
diff --git a/resources/views/themes/base/auth/passwords/reset.blade.php b/resources/views/themes/base/auth/passwords/reset.blade.php index 7a7952b..cdd0562 100644 --- a/resources/views/themes/base/auth/passwords/reset.blade.php +++ b/resources/views/themes/base/auth/passwords/reset.blade.php @@ -2,70 +2,76 @@ @section('title', trans('auth.reset_password_title')) @section('content') -
-
-
-
-
@yield('title')
+
+
+
+
+
+ +
+
+ + {{ csrf_field() }} -
- - {{ csrf_field() }} + - +
+ -
- +
+ -
- - - @if ($errors->has('email')) - - {{ $errors->first('email') }} - - @endif + @if ($errors->has('email')) + + @endif +
-
-
- +
+ -
- +
+ - @if ($errors->has('password')) - - {{ $errors->first('password') }} - - @endif + @if ($errors->has('password')) + + @endif +
-
-
- -
- +
+ +
+ - @if ($errors->has('password_confirmation')) - - {{ $errors->first('password_confirmation') }} - - @endif + @if ($errors->has('password_confirmation')) + + @endif +
-
-
-
- +
+
+ @lang('forms.cancel_action') + +
-
- + +
-
@endsection