public function verify($username, $password) { $credentials = ['email' => $username, 'password' => $password]; if (Auth::once($credentials)) { return Auth::user()->id; } return false; }
public function verify($username, $password) { $credentials = ['usuario' => $username, 'password' => $password]; if (Auth::once($credentials)) { return Auth::user()->IdUsuario; } return false; }
/** * Authenticate with json response, use for external auth * * @param Request $request * * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response */ public function authenticate(Request $request) { $params = $request->only('email', 'password'); if (Auth::once($params)) { return Auth::user(); } return response(['error' => 'Invalid user.']); }
public function verifyAdmin($username, $password) { $credentials = ['username' => $username, 'password' => $password]; if (Auth::once($credentials)) { return Auth::user()->type == "admin" ? Auth::user()->id : false; } else { return false; } }
public function verify($username, $password) { $credentials = ['contact_email' => $username, 'password' => $password]; // $user = EntityManager::getRepository('Services\User\Data\Entities\User\User')->find($username); if (Auth::once($credentials)) { return Auth::user()->id; } return false; }
public function verify($username, $password) { $telephoneCredentials = ['telephone' => $username, 'password' => $password]; $usernameCredentials = ['username' => $username, 'password' => $password]; $emailCredentials = ['email' => $username, 'password' => $password]; if (Auth::once($telephoneCredentials) || Auth::once($usernameCredentials) || Auth::once($emailCredentials)) { return Auth::user()->id; } return false; }
public function verify($username, $password) { $credentials = ['email' => $username, 'password' => $password]; if (Auth::once($credentials)) { return Auth::user()->id; } /*if(Auth::validate($credentials)){ $user = \CodeProject\Entities\User::where('email',$username)->first(); return $user->id; }*/ return false; }
public function auth(Request $request) { $data = $this->validateRequest($request, ['username', 'password'], true); $result = Auth::once(['username' => $data->username, 'password' => $data->password]); if ($result !== true || !Auth::user()->isDriver()) { throw new LoginException("Logging in user: {$data->username}"); } // Generate session key $key = Str::random(32); $this->cache->put("shuttle.{$this->shuttle->name}.key", $key, 60 * 8); $this->cache->put("shuttle.{$this->shuttle->name}.user", Auth::user(), 60 * 8); return $this->encryptJson(['key' => $key]); }
/** * 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')); }
public function verify($username, $password) { $credentials = ['email' => $username, 'password' => $password]; // Check for FB login if ($this->request->has('token_facebook')) { $user = $this->userRepo->createUser($this->request->all()); return $user->id; } // For normal users if (Auth::once($credentials)) { return Auth::user()->id; } return false; }
/** * Logs the user in. * * @return \Illuminate\Http\RedirectResponse */ public function loginPost() { $loginData = Request::only(['login', 'password']); // Login with username or email. $loginKey = Str::contains($loginData['login'], '@') ? 'email' : 'username'; $loginData[$loginKey] = array_pull($loginData, 'login'); // 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('/') return Redirect::home()->withSuccess(trans('gitamin.signin.success')); } return Redirect::route('auth.login')->withInput(Request::except('password'))->withError(trans('gitamin.signin.invalid')); }
public function verify($username, $password) { $hash = Request::input('hash'); $credentials = ['username' => $username, 'password' => $password]; if (presence($hash) && $hash === 'md5') { // prehashed, we want to skip the md5 step of OsuHasher $user = User::where('username', $username)->first(); if (password_verify($password, $user->getAuthPassword())) { return $user->user_id; } } else { if (Auth::once($credentials)) { return Auth::user()->user_id; } } return false; }
/** * 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); // Do we have Two Factor Auth enabled? if (Auth::user()->hasTwoFactor) { // Temporarily store the user. Session::put('2fa_id', Auth::user()->id); return Redirect::route('auth.two-factor'); } // 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')); }
/** * @param $data * @return \Alfredoem\Ragnarok\Soul\RagnarokResponse */ public function login($data) { if (!key_exists('remember', $data)) { $data['remember'] = false; } // login attempt if (Auth::once(['email' => $data['email'], 'password' => $data['password']], $data['remember'])) { $auth = Auth::user(); // Store session user $session = SecUserSessions::create(['userId' => $auth->userId, 'sessionCode' => Make::uniqueString(), 'ipAddress' => $data['ipAddress'], 'status' => 1, 'dateIns' => date('Y-m-d'), 'datetimeIns' => date('Y-m-d H:m:s')]); $auth->ipAddress = $data['ipAddress']; $auth->sessionCode = $session->sessionCode; $auth->userSessionId = $session->userSessionId; $auth->environment = Session::get('environment'); // Make ragnarok user $this->userRagnarok->make($auth); $this->success = true; } return $this->responseRagnarok->make($this->success, $this->userRagnarok); }
/** * Handle a login request to the application. * * @param LoginRequest $request * @return Response */ protected function postLogin(Request $request) { $throttles = $this->isUsingThrottlesLoginsTrait(); $credentials = $this->getCredentials($request); $validator = Validator::make($credentials, ['email' => 'required|email', 'password' => 'required']); if ($validator->fails()) { if (!$this->api) { return redirect(route('login'))->withErrors($validator); } else { return response()->json(['data' => ['errors' => $validator->errors()->getMessages()]], 400); } } $result = $this->api ? Auth::once($credentials, $request->has('remember')) : Auth::attempt($credentials, $request->has('remember')); if (!$result) { if (!$this->api) { return redirect(route('register')); } else { return response()->json(['data' => ['message' => 'Error authorization']], 401); } } if (!$this->api) { return redirect(route('home')); } else { $token = Auth::user()->generationToken(); return response()->json(['data' => ['token' => $token]], 200); } }
/** * @param $username * @param $password * @return bool or user id */ public function authenticate($username, $password) { $credentials = ['email' => $username, 'password' => $password]; if (Auth::once($credentials)) { return Auth::user()->id; } Log::info("Tentativa de login falhou. Usuário: {$username}, Senha: {$password}"); return false; }