/** * Store a newly created resource in storage. * * @return Response */ public function store() { if (\Auth::attempt(\Input::only('email', 'password'))) { return \Redirect::intended(route(\Config::get('admin.home_route')))->with('alert', array('type' => 'success', 'message' => 'Seja bem vindo.')); } return \Redirect::back()->withInput()->with('alert', array('type' => 'danger', 'message' => 'Usuário e/ou senha incorretos.')); }
/** * Store a newly created resource in storage. * POST /properties * * @return Response */ public function store() { $input = Input::all(); $v = Validator::make(Input::All(), array('name' => 'required|max:50|', 'description' => 'required|max:400|min:10', 'ownerID' => 'required')); if ($v->passes()) { $agent_id = Sentry::getUser()->id; $property = new Property(); $property->name = Input::get('name'); $property->description = Input::get('description'); $property->ownerID = Input::get('ownerID'); $property->agent_id = $agent_id; $property->save(); $newprop = Property::where('name', Input::get('name'))->first(); $newprop_id = $newprop->id; foreach (Input::get('CBgroup1', array()) as $value) { $housedue = new Housedue(); $housedue->propertyID = $newprop_id; $housedue->receivable = $value; $converted = strtolower(preg_replace("/[[:blank:]]+/", "_", $value)); $housedue->db_name = $converted; $housedue->save(); } return Redirect::intended('admin/property'); } return Redirect::back()->withInput()->withErrors($v)->with('message', 'There were validation errors'); }
public function getTagPosts($name) { try { $tag = Tag::where('name', $name)->first(); if (!$tag) { throw new Exception("Tag not found"); } $posts = $tag->posts()->paginate(8); $i = 0; foreach ($posts as $post) { if (!PrivacyHelper::checkPermission(Auth::user(), $post)) { unset($posts[$i]); $i++; continue; } $i++; $post->makrdown = str_limit($post->makrdown, $limit = 500, $end = '...'); $Parsedown = new Parsedown(); $post->HTML = $Parsedown->text($post->makrdown); } if (Request::ajax()) { return View::make('posts._list')->with('data', $posts); } else { if (count($posts) == 0) { return Redirect::intended(URL::action('ProfileController@getProfile', array($id))); } $this->layout->content = View::make('posts.list')->with('data', $posts); } } catch (Exception $e) { throw $e; } }
public function index() { if (Session::has('user')) { Auth::login(Session::get('user')); if (Auth::user()->hak_akses == '1') { return Redirect::intended('hrdstaff'); } elseif (Auth::user()->hak_akses == '2') { return Redirect::intended('hrdmanager'); } elseif (Auth::user()->hak_akses == '3') { return Redirect::intended('direktur'); } elseif (Auth::user()->hak_akses == '4') { return Redirect::intended('hrga'); } elseif (Auth::user()->hak_akses == '5') { return Redirect::intended('keuangan'); } elseif (Auth::user()->hak_akses == '6') { return Redirect::intended('karyawan'); } elseif (Auth::user()->hak_akses == '7') { return Redirect::intended('pelamar'); } else { return View::make('home'); } } else { return View::make('home'); } }
/** * Log in to site. * * @return Response */ public function login() { if (Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password')), true) || Auth::attempt(array('username' => Input::get('email'), 'password' => Input::get('password')), true)) { return Redirect::intended('dashboard'); } return Redirect::back()->withInput(Input::except('password'))->with('message', 'Wrong creadentials!'); }
/** * Display customer login screen. * * @return Response */ public function login() { if (Auth::check()) { return Redirect::route('profile'); } elseif (Request::isMethod('post')) { $loginValidator = Validator::make(Input::all(), array('email' => 'required', 'password' => 'required')); if ($loginValidator->passes()) { $inputCredentials = array('email' => Input::get('email'), 'password' => Input::get('password')); if (Auth::attempt($inputCredentials)) { $customer = Customer::find(Auth::id()); if ($customer->admin_ind) { Session::put('AdminUser', TRUE); } if (is_null($customer->address)) { // If customer does not have address, redirect to create address. return Redirect::route('customer.address.create', Auth::id())->with('message', 'No address found for account. Please enter a valid address.'); } return Redirect::intended('profile')->with('message', 'Login successful.'); } return Redirect::back()->withInput()->withErrors(array('password' => array('Credentials invalid.'))); } else { return Redirect::back()->withInput()->withErrors($loginValidator); } } $this->layout->content = View::make('customers.login'); }
public function login() { if (Input::has('url')) { // only allow local urls as redirect destinations $url = Input::get('url'); if (!preg_match("~^(//|[^/]+:)~", $url)) { Session::flash('url.intended', $url); } } if (!$this->account->samlLogged()) { Auth::logout(); $this->account->samlLogin(); } if ($this->account->samlLogged()) { $id = $this->account->getSamlUniqueIdentifier(); if (!$this->account->IdExists($id)) { if (Config::get('laravel-saml::saml.can_create', true)) { $this->account->createUser(); } else { return Response::make(Config::get('laravel-saml::saml.can_create_error'), 400); } } else { if (!$this->account->laravelLogged()) { $this->account->laravelLogin($id); } } } if ($this->account->samlLogged() && $this->account->laravelLogged()) { $intended = Session::get('url.intended'); $intended = str_replace(Config::get('app.url'), '', $intended); Session::flash('url.intended', $intended); return Redirect::intended('/'); } }
public function postLogon() { $valid = Validator::make(Input::all(), ['email' => 'required|email', 'password' => 'required'], ['password.required' => trans('larauth::larauth.password_required')]); if ($valid->fails()) { return Redirect::route('larauth.logon')->with('errors', $valid->errors())->with(Input::all()); } try { $user = Sentry::authenticate(['email' => Input::get('email'), 'password' => Input::get('password')], Input::get('remember')); // redirect to url before authetificate return Redirect::intended(); } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) { echo 'Login field is required.'; } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) { echo 'Password field is required.'; } catch (Cartalyst\Sentry\Users\WrongPasswordException $e) { //echo 'Wrong password, try again.'; $valid->errors()->add('password', trans('larauth::larauth.wrong_password')); } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) { echo 'User was not found.'; } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) { echo 'User is not activated.'; } catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e) { //echo 'User is suspended.'; $valid->errors()->add('password', trans('larauth::larauth.user_suspended')); } catch (Cartalyst\Sentry\Throttling\UserBannedException $e) { echo 'User is banned.'; } return Redirect::route('larauth.logon')->with('errors', $valid->errors())->with(Input::all()); }
public function logIn() { //code to login user $validator = Validator::make(Input::all(), array('User_Name' => 'required', 'Password' => 'required')); if ($validator->fails()) { return Redirect::route('login-get')->withErrors($validator)->withInput(); } else { $auth = Auth::attempt(array('username' => Input::get('User_Name'), 'password' => Input::get('Password'))); if ($auth) { // select the account to load and redirect to the intended page return Redirect::intended(); } else { $auth2 = Auth::attempt(array('email' => Input::get('User_Name'), 'password' => Input::get('Password'))); if ($auth2) { // select the account to load and redirect to the intended page return Redirect::intended(); } else { $auth3 = Auth::attempt(array('phone_number' => Input::get('User_Name'), 'password' => Input::get('Password'))); if ($auth3) { // select the account to load and redirect to the intended page return Redirect::intended(); } else { return Redirect::route('login-get')->with('global', 'Username - Password Mismatch'); } } } } }
/** * Login action * @return Redirect */ public function postLogin($target = 'admin') { $input = Input::all(); $credentials = array('login' => $input['username'], 'password' => $input['password']); $remember = isset($input['remember']) && $input['remember'] == 'checked' ? true : false; try { $user = Sentry::authenticate($credentials, $remember); if ($user) { if (isset($input['api'])) { return Response::json(array(), 200); } else { return Redirect::intended($target); } } } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) { if (isset($input['api'])) { return Response::json(array('error' => trans('users.check_activation_email')), 200); } else { return Redirect::back()->withErrors(trans('users.check_activation_email')); } } catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e) { if (isset($input['api'])) { return Response::json(array('error' => trans('users.account_suspended', array('minutes' => 10))), 200); } else { return Redirect::back()->withErrors(trans('users.account_suspended', array('minutes' => 10))); } } catch (Exception $e) { if (isset($input['api'])) { return Response::json(array('error' => trans('users.invalid_username_pw')), 200); } else { return Redirect::back()->withErrors(trans('users.invalid_username_pw')); } } }
public function postLogin() { try { // Login credentials $credentials = array('email' => Input::get('username'), 'password' => Input::get('password')); // Authenticate the user $user = Sentry::authenticate($credentials, false); return Redirect::intended('/'); } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) { $msg = 'Login field is required.'; } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) { $msg = 'Password field is required.'; } catch (Cartalyst\Sentry\Users\WrongPasswordException $e) { $msg = 'Wrong password, try again.'; } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) { $msg = 'User was not found.'; } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) { $msg = 'User is not activated.'; } catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e) { $msg = 'User is suspended.'; } catch (Cartalyst\Sentry\Throttling\UserBannedException $e) { $msg = 'User is banned.'; } return Redirect::to('auth/login')->withInput()->with('exception', $msg); }
/** * Authentication with Clef account * * @return Response */ public function authentication() { $response = Clef::authentication($_GET['code']); // error if (!$response) { $error = 'Error'; // error } elseif (isset($response['error'])) { $error = $response['error']; // success } elseif (isset($response['success'])) { // verif if exists account in Authentication table $verif = Authentication::whereprovider("clef")->whereprovider_uid($response['info']['id'])->first(); // no account if (empty($verif)) { // Find account } else { // Find the user using the user id $user = User::find($verif->user_id); // RAZ logout if ($user->logout == 1) { $user->logout = 0; $user->save(); } // Log the user in Auth::login($user); return Redirect::intended('/'); } // error } else { $error = 'Unknown error'; } return Redirect::to("login")->withErrors($error); }
public function postIndex() { $rules = array('username' => 'required|alpha_dash', 'password' => 'required|min:8'); $input = Input::all(); $validator = Validator::make($input, $rules); $validator->sometimes('username', 'unique:users,name', function ($input) { return $input->action == 'register'; }); if ($validator->fails()) { return Redirect::to('login')->withErrors($validator); } if ($input['action'] == 'login') { if (Auth::attempt(array('name' => $input['username'], 'password' => $input['password']), Input::has('remember') ? true : false)) { return Redirect::to('/'); } else { return Redirect::to('login')->withErrors(array('message' => Lang::get('login.error'))); } } elseif ($input['action'] == 'register') { $user = new User(); $user->name = $input['username']; $user->password = Hash::make($input['password']); $user->save(); Auth::login($user); return Redirect::intended('/'); } }
/** * AdminUserController::postLogin() * * @return */ public function postLogin() { $userService = new UserAccountService(); $rules = array('email' => 'Required|email', 'password' => 'Required'); $validator = \Validator::make(\Input::all(), $rules); if (!$validator->fails()) { $user = array('email' => \Input::get('email'), 'password' => \Input::get('password')); $remember = \Input::get('remember'); $error = $userService->doLogin($user, $remember); if ($error == '') { $redirect = ''; if (\Sentry::getUser()->hasAnyAccess(['system'])) { $redirect = \Config::get('webshopauthenticate::admin_uri'); } else { $redirect = \Config::get('webshopauthenticate::uri') . '/myaccount'; } return \Redirect::intended($redirect); } $error_msg = ''; if ($error == 'Invalid') { $error_msg = \Lang::get('webshopauthenticate::auth/form.login.invalid_login'); } else { if ($error == 'ToActivate') { $error_msg = \Lang::get('webshopauthenticate::auth/form.login.account_not_confirmed'); } } \Session::flash('error', $error_msg); return \Redirect::to(\Config::get('webshopauthenticate::uri') . '/login')->withInput(); } else { return \Redirect::to(\Config::get('webshopauthenticate::uri') . '/login')->withErrors($validator->messages())->withInput(); } }
/** * Store a newly created session in storage. * POST /session * * @return Response */ public function store() { // Attempt to login try { // Login credentials $credentials = array('email' => Input::get('email'), 'password' => Input::get('password')); // Authenticate the user if (Auth::attempt($credentials)) { // Store Session values for user Session::put('email', $credentials['email']); Session::put('user_id', User::getIdFromEmail($credentials['email'])); // Redirect to dashboard with message Session::flash('alert_success', 'Logged in successfully.'); return Redirect::intended('dashboard'); } else { Session::flash('alert_warning', 'Unable to login. Please check your username and password, and try again.'); return Redirect::to(secure_url('/login'))->withInput(); } } catch (\RuntimeException $e) { // An unexpected error occurred. Log::error(date("Y-m-d H:i:s") . '- RuntimeException in app/contorllers/SessionController: ' . '\\$data = ' . print_r($data) . $e); Session::flash('alert_danger', 'An unexpected error occurred.'); return Redirect::to(secure_url('/login'))->withInput(); } }
/** * Decide whether to update an existing character, or create a new one. * * @return Response */ public function register() { $validator = Validator::make($data = Input::only('name', 'password'), Character::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $pheal = new Pheal(Config::get('phealng.keyID'), Config::get('phealng.vCode')); $query = $pheal->eveScope->CharacterID(array('names' => $data['name'])); foreach ($query->characters as $character) { $data['characterID'] = $character->characterID; } if ($data['characterID']) { $character = Character::firstOrNew(array('name' => Input::get('name'))); if (!$character->active) { $character->id = $data['characterID']; $character->name = $data['name']; $character->password = Hash::make($data['password']); $character->active = 1; if ($character->save()) { Auth::login($character); return Redirect::intended('/'); } } else { return Redirect::back()->withErrors(array('name' => 'This character is already registered.'))->withInput(); } } else { return Redirect::back()->withErrors(array('name' => 'No character with this name could be found.'))->withInput(); } }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $chance = Input::all(); $chance['users_id'] = Auth::user()->id; Chance::create($chance); return Redirect::intended('/chanceslist'); }
public function studentLogout() { $logout = Input::get('stream'); Auth::$logout()->logout(); Session::forget('stream'); return Redirect::intended('/'); }
/** * Attempt to do login * */ public function do_login() { $input = array('email' => Input::get('email'), 'username' => Input::get('email'), 'password' => Input::get('password'), 'remember' => Input::get('remember')); // If you wish to only allow login from confirmed users, call logAttempt // with the second parameter as true. // logAttempt will check if the 'email' perhaps is the username. // Get the value from the config file instead of changing the controller if (Confide::logAttempt($input, Config::get('confide::signup_confirm'))) { // Redirect the user to the URL they were trying to access before // caught by the authentication filter IE Redirect::guest('user/login'). // Otherwise fallback to '/' // Fix pull #145 return Redirect::intended('/home'); // change it to '/admin', '/dashboard' or something } else { $user = new User(); // Check if there was too many login attempts if (Confide::isThrottled($input)) { $err_msg = Lang::get('confide::confide.alerts.too_many_attempts'); } elseif ($user->checkUserExists($input) and !$user->isConfirmed($input)) { $err_msg = Lang::get('confide::confide.alerts.not_confirmed'); } else { $err_msg = Lang::get('confide::confide.alerts.wrong_credentials'); } return Redirect::action('UserController@login')->withInput(Input::except('password'))->with('error', $err_msg); } }
public function postLogin() { // Формируем базовый набор данных для авторизации // (isActive => 1 нужно для того, чтобы аторизоваться могли только // активированные пользователи) $creds = array('password' => Input::get('password'), 'isActive' => 1); // В зависимости от того, что пользователь указал в поле username // дополняем авторизационные данные $username = Input::get('username'); if (strpos($username, '@')) { $creds['email'] = $username; } else { $creds['username'] = $username; } // Пытаемся авторизовать пользователя if (Auth::attempt($creds, Input::has('remember'))) { Log::info("User [{$username}] successfully logged in."); return Redirect::intended(); } else { Log::info("User [{$username}] failed to login."); } $alert = "Неверная комбинация имени (email) и пароля, либо учетная запись еще не активирована."; // Возвращаем пользователя назад на форму входа с временной сессионной // переменной alert (withAlert) return Redirect::back()->withAlert($alert); }
/** * Saves/Edits an account * */ public function postEdit($id = false) { if ($id !== false) { $account = CloudAccount::where('user_id', Auth::id())->findOrFail($id); } try { if (empty($account)) { $account = new CloudAccount(); } else { if ($account->user_id !== Auth::id()) { throw new Exception('general.access_denied'); } } $account->name = Input::get('name'); $account->cloudProvider = Input::get('cloudProvider'); $account->credentials = json_encode(Input::get('credentials')); $account->user_id = Auth::id(); // logged in user id $conStatus = CloudProvider::authenticate($account); if ($conStatus == 1) { Log::info('Credentials are encrypted before saving to DB.'); CloudAccountHelper::save($account); return Redirect::intended('account')->with('success', Lang::get('account/account.account_updated')); } else { return Redirect::to('account')->with('error', Lang::get('account/account.account_auth_failed') . ' for ' . $account->cloudProvider); } } catch (Exception $e) { Log::error($e); return Redirect::to('account')->with('error', $e->getMessage()); } }
/** * Authenticate the user * @return [type] [description] */ public function store() { if (Auth::attempt(Input::only('email', 'password'), true)) { return Redirect::intended('/'); } return Redirect::back()->withInput()->withErrors(['Invalid Email or Password']); }
public function enviar_email(\Illuminate\Http\Request $request) { $input = $request->except(array('_token')); //não levar o token $buscar = \App\Models\pessoas::select('razaosocial', 'empresas_id', 'empresas_clientes_cloud_id')->where('emailprincipal', $input["email"])->get(); if ($buscar->count() > 0) { $usuario = User::select('id')->where('email', $input["email"])->where('password', bcrypt($input["password"]))->get(); if ($usuario->count() > 0) { return redirect()->guest('login'); } else { //criar usuario //Gera token qualquer $dados = str_random(30); $data = $input; $retorno = User::create(['name' => $buscar[0]->razaosocial, 'email' => $input["email"], 'password' => bcrypt($input["password"]), 'confirmation_code' => $dados]); usuario::create(['id' => $retorno->id, 'empresas_id' => $buscar[0]->razaosocial, 'empresas_clientes_cloud_id' => $input["email"]]); \Mail::send('emails.link_newuser', ['key' => $dados], function ($message) use($data) { $message->from('*****@*****.**', 'Sigma3'); $message->subject('Link para validação SIGMA3 - Área do Membro'); $message->to($data['email']); $message->bcc('*****@*****.**'); }); $conteudo = ['mensagem' => 'Verifique sua conta de email para validar o acesso ao sistema.']; } } else { $credentials = array('email' => $input["email"], 'password' => $input["password"]); if (Auth::attempt($credentials, true)) { Auth::login(Auth::user(), true); Auth::guard('web')->login($credentials); //return redirect('login'); return \Redirect::intended('login'); } } //return view('tutoriais.minhaigreja', ['conteudo'=>$conteudo]); }
/** * Store a newly created resource in storage. * POST /sessions/store. * * @return Response */ public function store() { // Set login credentials $input = array('email' => Input::get('email'), 'password' => Input::get('password')); // Try to authenticate the user try { Sentry::authenticate($input, Input::has('remember')); } catch (\Cartalyst\Sentry\Users\UserNotFoundException $e) { return Redirect::back()->withInput()->withErrorMessage('Invalid credentials provided'); } catch (\Cartalyst\Sentry\Users\UserNotActivatedException $e) { return Redirect::back()->withInput()->withErrorMessage('User Not Activated.'); } // Logged in successfully - redirect based on type of user $user = Sentry::getUser(); $adminsGroup = Sentry::findGroupByName('Admins'); $usersGroup = Sentry::findGroupByName('Users'); if ($user->inGroup($adminsGroup)) { return Redirect::intended('admin'); } elseif ($user->inGroup($usersGroup)) { if (!stripos(Session::get('url.intended', '/'), '/admin')) { return Redirect::intended('/'); } else { return Redirect::to('/'); } } }
public function doLogin() { $rules = array('email' => 'required', 'password' => 'required'); $allInput = Input::all(); $validation = Validator::make($allInput, $rules); //dd($allInput); if ($validation->fails()) { return Redirect::route('login')->withInput()->withErrors($validation); } else { $credentials = array('email' => Input::get('email'), 'password' => Input::get('password')); if (Auth::attempt($credentials)) { if (Auth::user()->access_level == '1') { return Redirect::intended('dashboard'); } elseif (Auth::user()->access_level == '2') { return Redirect::intended('doc_dashboard'); } elseif (Auth::user()->access_level == '4') { return Redirect::intended('patient_dashboard'); } else { return Redirect::intended('nurse_dashboard'); } } else { return Redirect::route('login')->withInput()->withErrors('Error in Email Address or Password.'); } } }
public function refundStore() { $input = Input::all(); $v = Validator::make(Input::All(), array('houseID' => 'required', 'tenant' => 'required', 'type' => 'required', 'rentD' => 'required', 'waterD' => 'required', 'electricityD' => 'required', 'grepairs' => 'required', 'Obills' => 'required', 'Tcost' => 'required', 'Sfees' => 'required', 'duedate' => 'required')); if ($v->passes()) { $balance = Input::get('rentD') + Input::get('waterD') + Input::get('grepairs') + Input::get('Obills') + Input::get('Tcost') + Input::get('Sfees') + Input::get('electricityD'); $invoice = new Invoice(); $invoice->type = Input::get('type'); $invoice->houseID = Input::get('houseID'); $invoice->recipient = Input::get('tenant'); $invoice->balance = $balance; $invoice->duedate = Input::get('duedate'); $invoice->save(); $invoicedetail = new Invoicedetail(); $invoicedetail->rentD = Input::get('rentD'); $invoicedetail->waterD = Input::get('waterD'); $invoicedetail->g_repairs = Input::get('grepairs'); $invoicedetail->o_bills = Input::get('Obills'); $invoicedetail->transport_cost = Input::get('Tcost'); $invoicedetail->storage_fees = Input::get('Sfees'); $invoicedetail->electricityD = Input::get('electricityD'); $invoice->invoicedetail()->save($invoicedetail); return Redirect::intended('admin/invoice'); } return Redirect::back()->withInput()->withErrors($v)->with('message', 'There were validation errors'); }
function validate() { if (!Session::has('vatsimauth')) { throw new AuthException('Session does not exist'); } $SSO = new SSO(Config::get('vatsim.base'), Config::get('vatsim.key'), Config::get('vatsim.secret'), Config::get('vatsim.method'), Config::get('vatsim.cert')); $session = Session::get('vatsimauth'); if (Input::get('oauth_token') !== $session['key']) { throw new AuthException('Returned token does not match'); return; } if (!Input::has('oauth_verifier')) { throw new AuthException('No verification code provided'); } $user = $SSO->checkLogin($session['key'], $session['secret'], Input::get('oauth_verifier')); if ($user) { Session::forget('vatsimauth'); $authUser = User::find($user->user->id); if (is_null($authUser)) { $authUser = new User(); $authUser->vatsim_id = $user->user->id; $authUser->name = trim($user->user->name_first . ' ' . $user->user->name_last); } $authUser->last_login = Carbon::now(); $authUser->save(); Auth::login($authUser); Messages::success('Welcome on board, <strong>' . $authUser->name . '</strong>!'); return Redirect::intended('/'); } else { $error = $SSO->error(); throw new AuthException($error['message']); } }
public function loginTry() { try { Input::only('email', 'password', 'remember_me'); // Set login credentials $credentials = array('email' => Input::get('email'), 'password' => Input::get('password')); // Try to authenticate the user if (Input::get('remember_me') == true) { $user = Sentry::authenticateAndRemember($credentials); } else { $user = Sentry::authenticate($credentials); } return Redirect::intended('/')->with('global_success', 'You are now logged in.'); } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) { return Redirect::to('/login')->with('login_error', 'Login field is required.'); } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) { return Redirect::to('/login')->with('login_error', 'Password field is required.'); } catch (Cartalyst\Sentry\Users\WrongPasswordException $e) { return Redirect::to('/login')->with('login_error', 'Your username/password combination was incorrect.'); } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) { return Redirect::to('/login')->with('login_error', 'Your username/password combination was incorrect.'); } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) { return Redirect::to('/login')->with('login_error', 'You need to activate your account before log in.'); } catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e) { return Redirect::to('/')->with('global_error', 'Depends on violation, your account has been suspended or banned.'); } catch (Cartalyst\Sentry\Throttling\UserBannedException $e) { return Redirect::to('/')->with('global_error', 'Depends on violation, your account has been suspended or banned.'); } }
public function postIndex() { if (\Auth::attempt(array('email' => \Input::get('email'), 'password' => \Input::get('password')))) { return \Redirect::intended('/'); } return \Redirect::to('/?errors=true'); }
public function postLogin() { include app_path() . "/include/cifrado.php"; $errores = new Errores(); $empresas = new Empresa(); $data = Input::all(); $empresa = $empresas->getEmpresabyEmail($data['email']); if (!$empresa) { $errores->addError('Usuario o contraseña incorrectos'); return Redirect::action('Empresa_EmpresaController@getLogin')->with('errores', $errores->all()); } $pass = $empresa->password; if (descifrar($data['password'], $pass)) { Session::flush(); Session::put('ip_address', $_SERVER['REMOTE_ADDR']); Session::put('logged_empresa', true); Session::put('id_empresa', $empresa->id); $empresa->accesos_erroneos = 0; $empresa->save(); //return Redirect::action('Empresa_EmpresaController@getIndex'); return Redirect::intended('empresa/index'); } else { $accesos = $empresa->accesos_erroneos; $empresa->accesos_erroneos++; $empresa->save(); Session::flush(); $errores->addError('Usuario o contraseña incorrectos'); return Redirect::action('Empresa_EmpresaController@getLogin')->with('errores', $errores->all()); } }