public function postLogin() { // Verify the submitted reCAPTCHA if (!ReCaptcha::check()) { $status = __d('system', 'Invalid reCAPTCHA submitted.'); return Redirect::back()->withStatus($status, 'danger'); } // Retrieve the Authentication credentials. $credentials = Input::only('username', 'password'); // Prepare the 'remember' parameter. $remember = Input::get('remember') == 'on'; // Make an attempt to login the Guest with the given credentials. if (!Auth::attempt($credentials, $remember)) { // An error has happened on authentication. $status = __d('system', 'Wrong username or password.'); return Redirect::back()->withStatus($status, 'danger'); } // The User is authenticated now; retrieve his Model instance. $user = Auth::user(); if (Hash::needsRehash($user->password)) { $password = $credentials['password']; $user->password = Hash::make($password); // Save the User Model instance - used with the Extended Auth Driver. $user->save(); } if ($user->active == 0) { Auth::logout(); // User not activated; go logout and redirect him back. $status = __d('system', 'There is a problem. Have you activated your Account?'); return Redirect::back()->withStatus($status, 'warning'); } // Prepare the flash message. $status = __d('system', '<b>{0}</b>, you have successfully logged in.', $user->username); // Redirect to the User's Dashboard. return Redirect::intended('admin/dashboard')->withStatus($status); }