Added info messages when registering and activating accounts

This commit is contained in:
Andy Heathershaw 2016-09-06 14:45:51 +01:00
parent eb49f3230d
commit 00b238b3c6
6 changed files with 27 additions and 6 deletions

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\User;
use Illuminate\Foundation\Auth\RedirectsUsers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
class ActivateController extends Controller
@ -28,7 +29,7 @@ class ActivateController extends Controller
$this->middleware('guest');
}
public function activate($token)
public function activate(Request $request, $token)
{
/** @var User $user */
$user = User::where(['is_activated' => false, 'activation_token' => $token])->first();
@ -43,6 +44,8 @@ class ActivateController extends Controller
$user->activation_token = null;
$user->save();
$request->session()->flash('info', trans('auth.account_activated_message'));
return redirect($this->redirectPath());
}
}

View File

@ -54,8 +54,10 @@ class LoginController extends Controller
*
* @return \Illuminate\Http\Response
*/
public function showLoginForm()
public function showLoginForm(Request $request)
{
return Theme::render('auth.login');
return Theme::render('auth.login', [
'info' => $request->session()->get('info')
]);
}
}

View File

@ -9,9 +9,9 @@ use App\Mail\UserActivationRequired;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Validator;
class RegisterController extends Controller
{
@ -109,6 +109,7 @@ class RegisterController extends Controller
{
// Send activation e-mail
Mail::to($user)->send(new UserActivationRequired($user));
$request->session()->flash('info', trans('auth.activation_required_message'));
}
return redirect($this->redirectPath());

View File

@ -5,15 +5,17 @@ namespace App\Http\Controllers\Gallery;
use App\Album;
use App\Facade\Theme;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class DefaultController extends Controller
{
public function index()
public function index(Request $request)
{
$albums = Album::withCount('photos')->get()->sortBy('name');
return Theme::render('gallery.index', [
'albums' => $albums
'albums' => $albums,
'info' => $request->session()->get('info')
]);
}
}

View File

@ -15,6 +15,11 @@ return [
'failed' => 'These credentials do not match our records.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
// Added by Andy
'account_activated_message' => 'Your account has been activated successfully. Please login using the e-mail address ' .
'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_link' => 'Forgotten your password?',
'forgot_password_title' => 'Send password reset link',
'login_page_title' => 'Login',

View File

@ -43,6 +43,14 @@
</div>
@endif
@if (isset($info))
<div class="container">
<div class="alert alert-info">
<strong><i class="fa fa-info-circle fa-fw"></i></strong> {{ $info }}
</div>
</div>
@endif
@yield('content')
</div>