public function login()
 {
     //echo "Came to validation part>>>!";
     if (Auth::attempt(array('email' => Input::json('email'), 'password' => Input::json('password')))) {
         return Response::json(Auth::user());
     } else {
         return Response::json(array('flash' => 'Invalid username or password'), 500);
     }
 }
Example #2
0
 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);
 }
Example #3
0
 public function postLogin(\App\Http\Requests\LoginUserRequest $request)
 {
     if (\Auth::attempt($request->except('_token'), true)) {
         return redirect()->intended('/');
     }
     return back()->withInput()->with(['message' => 'Wrong email or password']);
 }
Example #4
0
 public function authenticate () 
 {
   if (Auth::attempt(['mobile' => $mobile, 'password' => $password])) 
   {
     return redirect()->intended('home');
   }
 }
Example #5
0
 public function authenticate(Request $request)
 {
     if (Auth::attempt(['email' => $request->email, 'password' => $request->password])) {
         // Authentication passed...
         return redirect()->intended('/');
     }
 }
Example #6
0
 /**
  * Handle an authentication attempt.
  *
  * @return Response
  */
 public function authenticate()
 {
     if (Auth::attempt(['username' => $email, 'password' => $password, 'is_enabled' => 1])) {
         // Authentication passed...
         return redirect()->intended('home');
     }
 }
 /**
  * Handle an authentication attempt.
  *
  * @return Response
  */
 public function authenticate()
 {
     if (Auth::attempt(['usr_email' => $email, 'usr_password' => $password])) {
         // Authentication passed...
         return redirect()->intended('helloworld');
     }
 }
 /**
  * Handle a login request to the application.
  *
  * @param \Illuminate\Http\Request $request
  *
  * @return \Illuminate\Http\Response
  */
 public function postLogin(\Illuminate\Http\Request $request)
 {
     if (\App::environment('local')) {
         $this->validate($request, [$this->loginUsername() => 'required', 'password' => 'required']);
     } else {
         $this->validate($request, [$this->loginUsername() => 'required', 'password' => 'required', 'g-recaptcha-response' => 'required|recaptcha']);
     }
     // If the class is using the ThrottlesLogins trait, we can automatically throttle
     // the login attempts for this application. We'll key this by the username and
     // the IP address of the client making these requests into this application.
     $throttles = $this->isUsingThrottlesLoginsTrait();
     if ($throttles && $this->hasTooManyLoginAttempts($request)) {
         return $this->sendLockoutResponse($request);
     }
     $credentials = $this->getCredentials($request);
     if (\Auth::attempt($credentials, $request->has('remember'))) {
         return $this->handleUserWasAuthenticated($request, $throttles);
     }
     // If the login attempt was unsuccessful we will increment the number of attempts
     // to login and redirect the user back to the login form. Of course, when this
     // user surpasses their maximum number of attempts they will get locked out.
     if ($throttles) {
         $this->incrementLoginAttempts($request);
     }
     return redirect($this->loginPath())->withInput($request->only($this->loginUsername(), 'remember'))->withErrors([$this->loginUsername() => $this->getFailedLoginMessage()]);
 }
Example #9
0
 /**
  * Handle an authentication attempt.
  *
  * @return Response
  */
 public function authenticate()
 {
     if (Auth::attempt(['email' => $email, 'password' => $password])) {
         // Authentication passed...
         return redirect()->intended('/dash');
     }
 }
Example #10
0
 protected function loginUser(Request $request)
 {
     $email = $request['email'];
     $password = $request['password'];
     if (\Auth::attempt(['email' => $email, 'password' => $password])) {
         return redirect('/dashboard');
     }
 }
Example #11
0
 /**
  * Create a new authentication controller instance.
  *
  * @return void
  */
 public function authenticate()
 {
     $remember = Input::has('remember') ? true : false;
     if (Auth::attempt(['email' => $email, 'password' => $password], $remember)) {
         return redirect()->intended('dashboard');
     } else {
         return Redirect::to('/login')->withInput(Input::except('password'))->with('flash_notice', 'Your username/password combination was incorrect.');
     }
 }
 protected function login(LoginRequest $request)
 {
     $credentials = $request->only('email', 'password');
     if (Auth::attempt($credentials)) {
         return 'Success';
     } else {
         return 'Failed';
     }
 }
 public function postIndex(Request $req)
 {
     $username = \Auth::user()->username;
     if (\Auth::attempt(['username' => $username, 'password' => $req->password])) {
         $req->session()->forget('lock');
         return redirect('/');
     }
     return redirect()->back()->withErr('* Kata sandi tidak cocok!');
 }
 public function postLogin(Request $request)
 {
     $username = $request->input('username');
     $password = $request->input('password');
     if (\Auth::attempt(['username' => $username, 'password' => $password])) {
         $this->userRepository->createLog(Carbon\Carbon::now());
         return redirect('/');
     }
     return redirect('/login')->withErrors('Invalid Username or Password.');
 }
 public function login(Request $request)
 {
     $data = Input::only('username', 'password');
     $credentials = ['username' => $data['username'], 'password' => $data['password']];
     if (\Auth::attempt($credentials)) {
         //dd(\Auth::user());
         return response()->json(["success" => true], 200);
     }
     return response()->json(["success" => false], 401);
 }
 public function authenticate()
 {
     // $decrypt_pass = Crypt::decrypt($password);
     // if (Auth::attempt(['username' => $username, 'password' => $decrypt_pass])) {
     //     return redirect()->intended('dashboard');
     // }
     if (Auth::attempt(['username' => $username, 'password' => $password])) {
         return redirect()->intended('dashboard');
     }
 }
 public function postLogin(Request $request)
 {
     $auth = \Auth::attempt(['email' => $request->input('email'), 'password' => $request->input('password')]);
     if ($auth) {
         \Session::set('user', \Auth::user());
         return redirect("/home");
     } else {
         return redirect("/");
     }
 }
Example #18
0
 public function postLogin(Request $request)
 {
     $this->validate($request, [$this->loginUsername() => 'required', 'password' => 'required']);
     $credentials = $this->getCredentials($request);
     if (\Auth::attempt($credentials, $request->has('remember'))) {
         return redirect('/home');
     }
     $request->session()->flash('message', 'Login Error');
     return redirect('/Auth/login');
 }
Example #19
0
 public function postLogin(Request $request)
 {
     $this->validate($request, ['email' => 'required', 'password' => 'required']);
     $credentials = $request->only('email', 'password');
     $credentials['approved'] = 1;
     if (\Auth::attempt($credentials, $request->has('remember'))) {
         return redirect()->intended($this->redirectPath());
     }
     return redirect('auth/login')->withInput($request->only('email'))->withErrors(['email' => 'You are not registered/approved']);
 }
 /**
  * Handle an authentication attempt.
  *
  * @return Response
  */
 public function authenticate()
 {
     if (Auth::attempt(['email' => $email, 'password' => $password])) {
         /* $name = Auth::user()->name;
         			$staff_type = Auth::user()->staff_type;
                 	\Session::put('message', 'Welcome : '.$staff_type."<br>". $name);
         			*/
         return redirect()->intended('home');
     }
 }
 /**
  * Handle an authentication attempt.
  *
  * @return Response
  */
 public function authenticate()
 {
     $username = \Request::input('username');
     $password = \Request::input('password');
     if (\Auth::attempt(['username' => $username, 'password' => $password])) {
         // Authentication passed...
         return redirect()->intended('admin/dashboard');
     } else {
         return redirect()->back()->withErrors("Invalid login.");
     }
 }
 public function logincheck()
 {
     $email = \Input::get('email');
     $password = \Input::get('password');
     if (\Auth::attempt(['email' => $email, 'password' => $password, 'role' => 1])) {
         return redirect('/home');
     } else {
         $data['msg'] = 'Invalid Details..';
         return \View::make('index', $data);
     }
 }
Example #23
0
 public function postLogin()
 {
     $credentials = ['password' => request('password')];
     $loginId = request('login_id');
     if (\filter_var($loginId, FILTER_VALIDATE_EMAIL) !== false) {
         $credentials['email'] = $loginId;
     } else {
         $credentials['username'] = $loginId;
     }
     return \Auth::attempt($credentials, request('remember_me')) ? \Auth::user() : $this->errorJson('bad credentials', 1);
 }
Example #24
0
 public function postLogin(Request $request)
 {
     $username = $request->input('username');
     $password = $request->input('password');
     if (Auth::attempt(array('username' => $username, 'password' => $password), true)) {
         flash()->success('Tu sëkmingai prisijungei!');
         return redirect('/');
     } else {
         flash()->error('Blogas vartotojo vardas arba slaptaþodis!');
         return view('auth.login');
     }
 }
 public function login()
 {
     if (Input::has('username')) {
         $data = array('username' => Input::get('username'), 'passw' => Input::get('passw'));
         if (Auth::attempt($data)) {
             return Redirect::action('');
         } else {
             return Response::json(['response' => 'loi roi 1'], 404);
         }
     } else {
         return Response::json(['response' => 'loi roi 2'], 404);
     }
 }
Example #26
0
 public function postLogin(Request $request)
 {
     $rules = ['username' => 'required', 'password' => 'required'];
     $messages = ['required' => $this->getFailedLoginMessage()];
     $this->validate($request, $rules, $messages);
     $username = $request->input('username');
     $password = $request->input('password');
     if (\Auth::attempt(['username' => $username, 'password' => $password])) {
         return redirect()->intended($this->redirectPath);
     } else {
         return redirect($this->loginPath())->withInput($request->only($this->loginUsername(), 'remember'))->withErrors([$this->loginUsername() => $this->getFailedLoginMessage()]);
     }
 }
Example #27
0
 public function logincheck()
 {
     $email = \Input::get('username');
     $password = \Input::get('password');
     if (\Auth::attempt(['email' => $email, 'password' => $password, 'status' => 'active'])) {
         if (\Auth::user()->roll_id == 1) {
             return \View::make('adminhome');
         } else {
             return \View::make('userhome');
         }
     } else {
         return \View::make('index');
     }
 }
Example #28
0
 public function postLogin(Request $request, TokenAuth $tokenAuth)
 {
     $response = new Responder\GenericResponse();
     if (\Auth::attempt(['email' => $request->get('email'), 'password' => $request->get('password')])) {
         $token = $tokenAuth::get();
         $user = \App\User::with('categories')->where('email', '=', $request->get('email'))->first();
         $response->setToken($token);
         $response->user = $user;
         return \Response::json($response);
     } else {
         $response->fails = true;
         $response->messages = ['Auth' => 'Email Password Combo Incorrect'];
     }
     return \Response::json($response);
 }
 /**
  * Handle an authentication attempt.
  *
  * @return Response
  */
 public function authenticate()
 {
     $username = \Request::input('username');
     $password = \Request::input('password');
     if (\Auth::attempt(['username' => $username, 'password' => $password])) {
         // Authentication passed...
         if (\Auth::user()->user_type == 1) {
             return redirect()->intended('admin/dashboard');
         } else {
             return redirect()->intended('users/dashboard');
         }
     } else {
         return redirect()->intended('auth/login')->withInput()->with('error', 'Error: Invalid login. Please try again');
     }
 }
Example #30
0
 /**
  * Override the default postLogin method
  * to add JWT support.
  *
  * @param Request $request
  * @return $this
  */
 public function postLogin(Request $request)
 {
     $this->validate($request, ['email' => 'required|email', 'password' => 'required']);
     $credentials = $request->only('email', 'password');
     if (\Auth::attempt($credentials, $request->has('remember'))) {
         if (\Auth::user()->roles() == null || !in_array('web', \Auth::user()->roles()->lists('name', 'id')->toArray())) {
             \Auth::logout();
             return redirect($this->loginPath())->withErrors(['error' => 'Δεν έχετε πρόσβαση στη σελίδα']);
         }
         //if the login is successful, save the jwt at a cookie
         $jwt = JWTService::setCookie();
         return redirect()->to($this->redirectPath())->withCookie(cookie()->forever('jwtToken', $jwt));
     }
     return redirect($this->loginPath())->withInput($request->only('email', 'remember'))->withErrors(['email' => $this->getFailedLoginMessage()]);
 }