/** * @param Request $request * * @return mixed */ public function postLogin(Request $request) { $credentials = $request->only(['username', 'password']); $validator = Validator::make($credentials, ['username' => 'required', 'password' => 'required']); if ($validator->fails()) { return Redirect::back()->withInput()->withErrors($validator); } if (Auth::guard('admin')->attempt($credentials)) { return Redirect::intended(config('admin.prefix')); } return Redirect::back()->withInput()->withErrors(['username' => $this->getFailedLoginMessage()]); }
public function postLogin() { $input = Input::all(); $attempt = Auth::attempt(array('email' => $input['email'], 'password' => $input['password'], 'confirmed' => 1)); if ($attempt) { if (Request::ajax()) { return Response::json(array('user' => Auth::user())); } else { return Redirect::intended('home'); } } else { //Attempt again without checking 'confirmed' $attempt = Auth::validate(array('email' => $input['email'], 'password' => $input['password'])); if ($attempt) { //Credentials are correct. but email not verified $error = __('emailNotConfirmedYet'); $emailNotConfirmed = true; } else { $error = __('emailOrPasswordIncorrect'); } if (Request::ajax()) { return Response::json(array('error' => $error, 'emailNotConfirmed' => !empty($emailNotConfirmed) ? true : false), 400); } else { return Redirect::to(route('login'))->with('login:errors', [$error])->withInput(); } } }
public function register() { if (Request::isMethod('post')) { User::create(['name' => Request::get('name'), 'email' => Request::get('email'), 'password' => bcrypt(Request::get('password'))]); } return Redirect::intended('/'); }
/** * Store a newly created resource in storage. * * @return Response */ public function postLogin(Request $request) { $input = $request->only('email', 'password', 'type'); $remember = $request->get('rememberme'); try { // Authenticate the user $user = User::authenticate($input, $remember); return Redirect::intended('/admin'); } catch (\Lavalite\user\Exceptions\LoginRequiredException $e) { $result = 'Login field is required.'; } catch (\Lavalite\user\Exceptions\PasswordRequiredException $e) { $result = 'Password field is required.'; } catch (\Lavalite\user\Exceptions\WrongPasswordException $e) { $result = 'Wrong password, try again.'; } catch (\Lavalite\user\Exceptions\UserNotFoundException $e) { $result = $e->getMessage(); //'User was not found.'; } catch (\Lavalite\user\Exceptions\UserNotActivatedException $e) { $result = 'User is not activated.'; } catch (\Lavalite\user\Exceptions\UserSuspendedException $e) { $result = 'User is suspended.'; } catch (\Lavalite\user\Exceptions\UserBannedException $e) { $result = 'User is banned.'; } Session::flash('error', $result); return Redirect::to('admin/login')->withInput(); }
protected function login() { if (auth()->attempt(array('email' => Input::get('email'), 'password' => Input::get('password')), true) || auth()->attempt(array('name' => Input::get('email'), 'password' => Input::get('password')), true)) { return Redirect::intended('/'); } return back()->withInput()->with('message', 'Неверное имя пользователя и/или пароль!'); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next, ...$roles) { if (!$this->user->hasRole($roles)) { return Redirect::intended('/users/members'); } return $next($request); }
/** * Logs the user in. * * @return \Illuminate\Http\RedirectResponse */ public function postLogin() { if (Auth::attempt(Binput::only(['email', 'password']))) { return Redirect::intended('dashboard'); } Throttle::hit(Request::instance(), 10, 10); return Redirect::back()->withInput(Binput::except('password'))->with('error', 'Invalid email or password'); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $input = Input::only('email', 'password'); if (Auth::attempt($input)) { return Redirect::intended('/profile'); } return Redirect::back()->withFlashMessage('E-mail Address and/or Password incorrect'); }
public function save($slug, Request $request) { if (Auth::check() && Auth::user()->id == Page::slug($slug)->user->id) { $page = Page::slug($slug); $page->content = $request->content; $page->save(); } return Redirect::intended('/page/' . $slug); }
public function postLogin() { $data['email'] = Input::get('email'); $data['password'] = Input::get('password'); if (Auth::attempt($data, Input::get('remember'))) { return Redirect::intended('/'); } return Redirect::to('account/login')->with('errors', 'Datos incorrectos'); }
/** * Função para login no sistema. Os parâmetros (login e senha) são passados por POST * * @return mixed */ public function doLogin() { try { Auth::attempt(array('cpf' => Input::get('login'), 'senha' => Input::get('senha'))); return Redirect::intended('/'); } catch (Exception $e) { return Redirect::to('login')->withErrors($e->getMessage())->withInput(); } }
/** * Handle the reauthentication request to the application. * * @param \Illuminate\Http\Request $request * * @return \Illuminate\Http\Response */ public function postReauthenticate(Request $request) { $this->validate($request, ['password' => 'required']); $reauth = new ReauthLimiter($request); if (!$reauth->attempt($request->password)) { return Redirect::back()->withErrors(['password' => $this->getFailedLoginMessage()]); } return Redirect::intended(); }
/** * Handle the reauthentication request to the application. * * @param \Illuminate\Http\Request $request * * @return \Illuminate\Http\Response */ public function postReauthenticate(Request $request) { $this->validate($request, ['password' => 'required']); if (!Hash::check($request->password, Auth::user()->getAuthPassword())) { return Redirect::back()->withErrors(['password' => $this->getFailedLoginMessage()]); } $request->session()->set('reauthenticate.life', Carbon::now()->timestamp); $request->session()->set('reauthenticate.authenticated', true); return Redirect::intended(); }
public function login() { $title = Lang::get('auth::login.title'); if (Request::isMethod('POST')) { if (Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password'), 'activated' => 1, 'suspended' => 0), Input::has('remember'))) { return Redirect::intended(Config::get('auth::login.redirect')); } return Redirect::back()->with('attempt', false)->withInput(); } return View::make(Config::get('auth::login.view'), compact('title')); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $formData = Input::only('email', 'password'); $this->signInForm->validate($formData); if (!Auth::attempt($formData)) { Flash::message('We were unable to sign you in. Please check your credentials.'); return Redirect::back()->withInput(); } Flash::message('Welcome Back!'); return Redirect::intended('statuses'); }
/** * Process sign in post requests. * * @param Request $request * @return mixed */ public function postSignIn(Request $request) { $this->validate($request, ['email' => 'required|max:50|email', 'password' => 'required|min:6']); $remember = $request->has('remember') ? true : false; $auth = Auth::attempt(['email' => $request['email'], 'password' => $request['password'], 'active' => 1], $remember); if ($auth) { return Redirect::intended('/'); } else { return Redirect::route('account-sign-in')->with('global-error', 'Email/password wrong, or acount not activated.'); } }
/** * Check data sent on login and redirect to the correct route * * @param Request $request * @return mixed */ public function postIndex(Request $request) { $credentials = ['email' => $request->email, 'password' => $request->password]; // Success login if (Auth::attempt($credentials)) { $notice = ['alert' => 'success', 'message' => trans('auth.success')]; return Redirect::intended(route('dashboard'))->with('notice', $notice); } $notice = ['alert' => 'success', 'message' => trans('auth.failed')]; return Redirect::route('auth.index')->with('notice', $notice); }
public function authenticate() { $validation = Validator::make(Request::all(), ['email' => 'required|email', 'password' => 'required']); if ($validation->fails()) { return Redirect('/')->withInput()->withErrors($validation); } else { if (Auth::attempt(['email' => Request::get('email'), 'password' => Request::get('password')], 1)) { return Redirect::intended('/'); } } return Redirect::back(); }
public function doLogin() { // validate the info, create rules for the inputs $rules = array('username' => 'required|min:5', 'password' => 'required|min:6'); // run the validation rules on the inputs from the form $validator = Validator::make(Input::all(), $rules); // if the validator fails, redirect back to the form if ($validator->fails()) { return Redirect::route(UserItem::loginRoute(), UserItem::loginRouteParams())->withErrors($validator)->withInput(Input::except('password')); // send back the input (not the password) so that we can repopulate the form } else { // create our user data for the authentication $userdata = array('username' => Input::get('username'), 'password' => Input::get('password')); // attempt to do the login if (Auth::validate($userdata)) { // Valid Login $valid_login = true; // Get User $user = UserItem::findUser($userdata["username"]); // Check if User Disabled if (!$user->isEnabled()) { return Redirect::route(UserItem::loginRoute(), UserItem::loginRouteParams())->with(FLASH_MSG_ERROR, trans("auth-module::message.account_disabled")); } // Trigger Login Event & Validate mergeEventFireResponse(true, Event::fire('user.login_validate', array($user, &$valid_login))); // Check Valid if ($valid_login) { // Do Login Auth::login($user); // Add Login Log LoginLogItem::addLog($user, true); // Trigger Valid Login Event Event::fire('user.valid_login', array($user)); // validation successful! return Redirect::intended(URL::route(UserItem::dashboardRoute()))->with(FLASH_MSG_INFO, trans("auth-module::message.success_login")); } else { // Add Login Log LoginLogItem::addLog($user, false); // Trigger Invalid Login Event Event::fire('user.invalid_login', array($userdata['username'])); // validation not successful, send back to form return Redirect::route(UserItem::loginRoute(), UserItem::loginRouteParams())->with(FLASH_MSG_ERROR, trans("auth-module::message.invalid_login"))->withInput(Input::except('password')); } } else { // Add Login Log LoginLogItem::addLogUsername($userdata["username"], false); // Trigger Invalid Login Event Event::fire('user.invalid_login', array(Input::get('username'))); // validation not successful, send back to form return Redirect::route(UserItem::loginRoute(), UserItem::loginRouteParams())->with(FLASH_MSG_ERROR, trans("auth-module::message.invalid_login"))->withInput(Input::except('password')); } } }
public function postLogin() { // Obtenemos los datos del formulario $data = ['email' => Input::get('email'), 'password' => Input::get('password')]; // Verificamos los datos if (Auth::attempt($data, Input::get('remember'))) { // Si nuestros datos son correctos mostramos la página de inicio return Redirect::intended('/'); } // Si los datos no son los correctos volvemos al login y mostramos un error return Redirect::back()->with('errors', 'Datos incorrectos')->withInput(); }
public function social_callback($provider) { $user = Socialite::driver($provider)->user(); //dd($user); $data = ['name' => $user->getName(), 'email' => $user->getEmail()]; Auth::login(User::firstOrCreate($data)); User::where('email', $data['email'])->update(['avatar' => $user->avatar]); if (null != Session::get('subdomain')) { $subdomain = Session::get('subdomain'); return redirect("http://{$subdomain}.zealicon.in"); } return Redirect::intended('dashboard'); }
/** * Logs the user in. * * @return \Illuminate\Http\RedirectResponse */ public function postLogin() { $loginData = Binput::only(['email', 'password']); // Validate login credentials. if (Auth::validate($loginData)) { // Log the user in for one request. Auth::once($loginData); // We probably want to add support for "Remember me" here. Auth::attempt($loginData); return Redirect::intended('dashboard'); } return Redirect::route('auth.login')->withInput(Binput::except('password'))->withError(trans('forms.login.invalid')); }
function getMw($action = '') { Socialite::extend('microweber', function ($app) { $config = $app['config']['services.microweber']; return Socialite::buildProvider('Microweber\\Providers\\Socialite\\MicroweberProvider', $config); }); if ($action == 'callback') { $user = Socialite::driver('microweber')->user(); $user = UserProvider::findOrCreate($user, 'microweber'); Auth::login($user); return Redirect::intended('/'); } return Socialite::driver('microweber')->redirect(); }
public function loginProcess() { $input = Input::all(); $remember = Input::has('remember') ? true : false; if (Auth::attempt(['name' => $input['name'], 'password' => $input['password']], $remember)) { // validation successful! // redirect them to the secure section or whatever return Redirect::intended('/booking/admin'); } else { // validation not successful, send back to form return Redirect::to('/auth/login')->withErrors(array('invalid' => 'Het e-mailadres of wachtwoord klopt niet.')); // send back all errors to the login form } }
/** * Attemps to login with the given credentials. */ public function login() { $input = Input::all(); if ($this->repository->login($input)) { return Redirect::intended(); } if ($this->repository->isThrottled($input)) { $error = Lang::get('confide::confide.alerts.too_many_attempts'); } elseif ($this->repository->existsButNotConfirmed($input)) { $error = Lang::get('confide::confide.alerts.not_confirmed'); } else { $error = Lang::get('confide::confide.alerts.wrong_credentials'); } return Redirect::route('user.login')->withInput(Input::except('password'))->with('error', $error); }
public function root($event = null) { // dd($event); $event = Event::where('event_name', $event)->first(); // dd($event); if ($event == null) { return "event null @ root"; return redirect(redirect_home); } if (Auth::check()) { return Redirect::intended('battleground'); } // dd($_SERVER); return View::make('welcome'); }
public function userSignin() { $username = Input::get('username'); $password = Input::get('password'); /* if (Auth::attempt(array('username' => $username, 'password' => $password))) { return Redirect::intended('/home'); }*/ $users = DB::select('select * from users where username = ? and password=? ', [$username, $password]); if ($users) { return Redirect::intended('/home'); } //return view('user.index', ['users' => $users]); return Redirect::to('/'); }
public function store(Request $request) { $rules = array('email' => 'required|exists:users', 'password' => 'required'); $validator = Validator::make($request->input(), $rules); if ($validator->fails()) { return Redirect::to('login')->withInput(Input::except('password'))->withErrors($validator); } $credenciais = array('email' => $request->input('email'), 'password' => $request->input('password')); if (Auth::attempt($credenciais, true)) { $request = null; return Redirect::intended('login/create'); } else { return Redirect::to('login')->withInput(); } }
public function postLogin() { $credentials = Input::only('username', 'password'); $rules = array('username' => array('exists:users,username')); $validator = Validator::make($credentials, $rules); if ($validator->passes()) { if (Auth::attempt($credentials, $remember = true)) { return Redirect::intended('/')->withInput()->with('flash_message', 'Welcome Back!'); } else { return Redirect::to('/login')->withInput()->with('flash_message', 'Password failed; please try again.'); } } else { return Redirect::to('/login')->with('flash_message', 'Username does not exist.'); } }
public function store(Request $request) { $rules = array('email' => 'required|unique:users', 'username' => 'required', 'password' => 'required|min:6', 'password-repeat' => 'required|same:password'); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { return Redirect::to('/')->withInput(Input::except('password', 'password-repeat'))->withErrors($validator); } User::create(array('name' => Input::get('username'), 'email' => Input::get('email'), 'password' => Hash::make(Input::get('password')))); $credenciais = array('email' => $request->input('email'), 'password' => $request->input('password')); if (Auth::attempt($credenciais)) { $request = null; return Redirect::intended('login/create'); } else { return Redirect::to('login')->withInput(); } }