/**
  * Authentication attempt
  *
  * @return Response
  */
 public function postLogin(\App\Http\Requests\LoginRequest $request)
 {
     $credentials = $request->only('username', 'password');
     if ($this->auth->attempt($credentials)) {
         return redirect()->action('BookmarkController@getNewsFeed')->with('flash_message', trans('authentication.login_success'));
     } else {
         return redirect()->action('AuthenticationController@getLogin')->withInput($request->only('username'))->with('flash_message', trans('authentication.not_matched'));
     }
 }
 public function postLogin(LoginRequest $request)
 {
     if (Auth::attempt($request->only(['email', 'password']))) {
         return $request->ajax() ? json_encode(['error' => 0]) : redirect('/');
     }
     return $request->ajax() ? json_encode(['error' => 1, 'message' => 'The email or password wrong!']) : redirect()->route('login')->withErrors('The email or password wrong!');
 }
Beispiel #3
0
 /**
  * Authenticate user
  * @param Request $request
  */
 public function attempt(LoginRequest $request)
 {
     $params = $request->only('username', 'password');
     $person = new Person();
     $resp = $person->getUsername($params['username']);
     if (!empty($resp)) {
         if (\Hash::check($params['password'], $resp['password'])) {
             $request->session()->put('user', ['id' => $resp['id'], 'username' => $resp['username'], 'role' => $resp['role'], 'disp_name' => $resp['role'] == 'A' ? 'Administrator' : $resp['first_name'] . ' ' . $resp['last_name']]);
             $message = 'success';
         } else {
             //check for old hashing
             if (md5($params['password']) == $resp['password']) {
                 //convert old pass to new hashing
                 $resp['password'] = bcrypt($params['password']);
                 $id = 'person_' . $resp['id'];
                 $person->update($id, $resp);
                 $request->session()->put('user', ['id' => $resp['id'], 'username' => $resp['username'], 'role' => $resp['role'], 'disp_name' => $resp['role'] == 'A' ? 'Administrator' : $resp['first_name'] . ' ' . $resp['last_name']]);
                 $message = 'success';
             } else {
                 //invalid password
                 $message = 'invalid';
             }
         }
     } else {
         //invalid user
         $message = 'invalid';
     }
     return response(['login_status' => $message]);
 }
 /**
  * Handle a login request to the application.
  *
  * @param  LoginRequest  $request
  * @return Response
  */
 public function postLogin(LoginRequest $request)
 {
     if ($this->auth->attempt($request->only('email', 'password'))) {
         return redirect('/');
     }
     return redirect('/auth/login')->withErrors(['email' => 'These credentials do not match our records.']);
 }
 public function login(LoginRequest $request)
 {
     if (!Auth::attempt($request->only('email', 'password'), $request->has('remember_me'))) {
         return $this->json->error('Credentials Not Authorized ...');
     }
     return $this->json->set('redirect', URL::route('customers'))->success('Logged In Successfully ...');
 }
 public function authenticate(LoginRequest $request)
 {
     $data = $request->only('email', 'password');
     if ($this->auth->attempt($data)) {
         return redirect()->intended('/');
     }
     return redirect('login')->withInput()->withErrors('Usuário ou senha inválidos');
 }
Beispiel #7
0
 /**
  * Login method for Database authentication
  *
  * @param  LoginRequest  $request
  * @return \Illuminate\Http\Response
  */
 public function postLogin(LoginRequest $request)
 {
     if (Auth::attempt($request->only('email', 'password'), $request->has('remember'))) {
         return redirect()->intended($this->redirectPath());
     } else {
         return redirect()->guest($this->redirectPath())->withErrors(['Invalid login credentials'])->withInput();
     }
 }
Beispiel #8
0
 public function doLogin(LoginRequest $request)
 {
     if ($this->auth->attempt($request->only('email', 'password'), $request->has('remember'))) {
         return redirect('/');
     } else {
         return redirect('/auth/login')->withErrors(['email' => 'These credentials do not match our records.'])->withInput();
     }
 }
 public function postLogin(Requests\LoginRequest $request)
 {
     if (auth()->attempt($request->only('email', 'password'))) {
         $user = auth()->user();
         return redirect()->route('home')->with(['success' => 'You are now logged in']);
     } else {
         return redirect()->back()->withInput()->with(['error' => 'Login failed']);
     }
 }
 public function authenticate(Requests\LoginRequest $req)
 {
     $input = $req->only('username', 'password');
     if (auth()->attempt($input)) {
         return redirect()->intended('article');
     } else {
         return redirect('/');
     }
 }
 /**
  * @param LoginRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postLogin(LoginRequest $request)
 {
     $result = $this->auth->attempt($request->only(['email', 'password']), $request->get('remember', false));
     if (!$result) {
         return redirect()->route('get.login')->with('message', 'ユーザー認証に失敗しました');
     }
     return redirect()->route('admin.entry.index');
     //return redirect()->route('auth.get.login');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(LoginRequest $request)
 {
     if (Auth::attempt($request->only('username', 'password'), true)) {
         return redirect()->intended('/backend');
     } else {
         flash()->error('Wrong password or username.');
         return redirect()->route('login');
     }
     flash()->error('Sorry! Please try again.');
     return redirect()->route('login');
 }
 public function login(LoginRequest $request)
 {
     $credentials = $request->only('email', 'password');
     try {
         if (!($token = JWTAuth::attempt($credentials))) {
             return response()->json(['error' => 'invalid_credentials'], 401);
         }
     } catch (JWTException $e) {
         return response()->json(['error' => 'could_not_create_token'], 500);
     }
     return response()->json(['token' => $token, 'message' => 'Login Success', 'auth' => JWTAuth::toUser($token)->load('places')]);
 }
 /**
  * Check Credentials and Log user In
  *
  * @param LoginRequest|Request $request
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function post(LoginRequest $request)
 {
     $field = filter_var($request->input('credential'), FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
     $request->merge([$field => $request->input('credential')]);
     if (!$this->auth->attempt($request->only($field, 'password'))) {
         return redirect()->back()->withInput()->withErrors('Username or Password Not Found');
     }
     /* || $request->get('user_type', '') == 'user'*/
     if ($this->auth->user()->is('user')) {
         return redirect()->route('web.index');
     }
     return redirect()->route('home');
 }
 public function login(LoginRequest $request)
 {
     $credentials = $request->only('email', 'password');
     $token = null;
     try {
         $token = $this->jwtauth->attempt($credentials);
         if (!$token) {
             return response()->json(['invalid_email_or_password'], 422);
         }
     } catch (JWTAuthException $e) {
         return response()->json(['failed_to_create_token'], 500);
     }
     return response()->json(compact('token'));
 }
 public function login(LoginRequest $request)
 {
     $credentials = $request->only('email', 'password');
     if (Auth::attempt($credentials)) {
         if (Auth::user()->active == 0) {
             Auth::logout();
             return 'Please activate your account';
         } else {
             return 'You have been log in';
         }
     } else {
         return 'The username and password do not match';
     }
 }
 /**
  * Log a user in through the app log in form using JWT
  *
  * @param LoginRequest $request
  * @param bool $ajax
  * @return array|JsonResponse|Response (string = JWT, JsonResponse = invalid credentials or JWT error)
  */
 public function loginUserFromForm(LoginRequest $request, $ajax = true)
 {
     // Check the user credentials with Laravel Auth
     if (Auth::attempt($request->only('email', 'password'))) {
         $user = Auth::user();
         // Set the User's token key so that it corresponds with the current CSRF token
         $this->tokenManager->setUserTokenKey($user, $request->token_key);
         // Attempt to generate a JWT for the user
         $jwt = $this->tokenManager->getJwtFromUser($user);
         return $this->authenticateUser($jwt);
     }
     // If the user credentials could not be verified...
     if (!$ajax) {
         // For the Laravel non-AJAX implementation, return a response instead of pure JSON
         return response(['error' => 'Invalid Credentials', 'message' => $this->getFailedLoginMessage()], 401);
     }
     return ['error' => 'Invalid Credentials', 'message' => $this->getFailedLoginMessage()];
 }
 public function login(LoginRequest $request)
 {
     $credentials = $request->only('email', 'password');
     $credentials = ['email' => $request->input('email'), 'password' => $request->input('password')];
     if (Auth::attempt($credentials)) {
         /*
         Jika username dan password match, lakukan logika if berikut ini.
         kalau user belum mengaktifkan accountnya, maka logout, dan tampilka message untuk mengaktifkannya
         */
         if (Auth::user()->active == 0) {
             Auth::logout();
             return 'Please activate your account';
         } else {
             return 'You have been log in';
         }
     } else {
         return 'The username and password do not match';
     }
 }
 public function login(LoginRequest $request)
 {
     $credentials = $request->only('email', 'password');
     if (Auth::attempt($credentials)) {
         if (Auth::user()->active == 0) {
             Auth::logout();
             return 'Please activate your account';
         } else {
             if (Auth::user()->role == "user") {
                 $nama = Auth::user()->name;
                 return View('user');
             } else {
                 $nama = Auth::user()->name;
                 return View::make('admin')->with('nama', $nama);
             }
         }
     } else {
         return 'The username and password do not match';
     }
 }