I am working on checking if the user is active or not before logging in.
this is my current login code
public function login(Request $request)
{
$this->validateLogin($request);
if ($this->hasTooManyLoginAttempts($request)){
$this->fireLockoutEvent($request);
return $this->sendLockoutResponse($request);
}
$username = $request->get('username');
$password = $request->get('password');
$remember = $request->get('remember');
if($this->auth->attempt([
'username' => $username,
'password' => $password,
'activated' => 1
],$remember == 1 ? true : false)) {
if($this->guard()->user()->activated){
$request->session()->regenerate();
$this->clearLoginAttempts($request);
return redirect()->action('Front\PagesController@index');
}else{
$this->guard()->logout();
$request->session()->flush();
$request->session()->regenerate();
return redirect('login')
->with('activation_response', 'action.danger');
}
}
else{
$this->incrementLoginAttempts($request);
return redirect()->back()
->with('message','Incorrect username or password')
->with('status','danger')
->withInput();
}
}
in the check, if the user is not active, I want to display a flash message informing them that the account is inactive, but I want to include a link to the reactivation page.
I also have this in my partials folder as activation_response.blade.php
<a href="{{ url('/activation/resend') }}" class="new-account">Resend activation code</a>
My attempt to do this does not work, is there a way I can do this?
I also have laracasts / flash package.
looking for some direction how to do this.
user8107952
source
share