本文整理汇总了PHP中Illuminate\Contracts\Auth\Guard::attempt方法的典型用法代码示例。如果您正苦于以下问题:PHP Guard::attempt方法的具体用法?PHP Guard::attempt怎么用?PHP Guard::attempt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\Auth\Guard
的用法示例。
在下文中一共展示了Guard::attempt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postLogin
/**
* 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.']);
}
示例2: doLogin
/**
* Do login authentication
*
* @param CreateAuthRequest $request
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function doLogin(CreateAuthRequest $request)
{
$credentials = $request->only('email', 'password');
if ($this->auth->attempt($credentials, true)) {
return redirect()->route('admin.dashboard');
}
return redirect()->back()->withErrors(['general' => 'Invalid username or password!']);
}
示例3: doLogin
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();
}
}
示例4: postLogin
/**
* Handle a login request to the application.
*
* @param LoginRequest $request
* @return Response
*/
public function postLogin(Requests\Auth\LoginRequest $request)
{
$credentials = $request->only('email', 'password');
if ($this->auth->attempt($credentials, $request->has('remember'))) {
return redirect('/home');
}
return redirect('/auth/login')->withInput($request->only('email'))->withErrors(['email' => 'These credentials do not match our records.']);
}
示例5: postLogin
public function postLogin(LoginRequest $request)
{
$this->validate($request, ['email' => 'required|email', 'password' => 'required']);
$credentials = $request->only('email', 'password');
if ($this->auth->attempt($credentials, $request->has('remember'))) {
return redirect()->intended('jandje');
}
return redirect('jandje/login')->withInput($request->only('email', 'remember'))->with('message', 'De opgegeven gegevens zijn niet correct. Probeer het opnieuw.');
}
示例6: postLogin
public function postLogin(Request $request)
{
$this->validate($request, ['email' => 'required|email', 'password' => 'required'], ['email.required' => 'Поле email не заполнено', 'email.email' => 'Введен не верный email', 'password.required' => 'Пароль не введен']);
$credentials = $request->only('email', 'password');
if ($this->auth->attempt($credentials, $request->has('remember'))) {
return redirect()->route('admin.index');
}
return redirect()->route('admin.login')->withInput($credentials)->withErrors(['email' => 'Неверный email или пароль']);
}
示例7: postLogin
/**
* Handle a login request to the application.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function postLogin(Request $request)
{
$this->validate($request, ['email' => 'required|email', 'password' => 'required']);
$credentials = $request->only('email', 'password');
if ($this->auth->attempt($credentials, $request->has('remember'))) {
return redirect()->intended('/' . Config::get('lecter.uri'));
}
return redirect('auth/login')->withInput($request->only('email', 'remember'))->withErrors(['email' => 'Sorry, login failed... check your credentials.']);
}
示例8: store
/**
* Handle a login request to the application.
*
* @return \Illuminate\Http\Response
*/
public function store()
{
$this->validate($this->request);
$credentials = $this->request->only('email', 'password');
if ($this->auth->attempt($credentials, $this->request->has('remember'))) {
return redirect()->intended(route('admin.dashboard.index'))->with('success', 'You have logged in.');
}
return redirect()->route('auth.session.create')->with('danger', 'These credentials do not match our records.')->withInput($this->request->only('email'));
}
示例9: postLogin
public function postLogin(LoginForm $form)
{
$attempt = $this->auth->attempt(['email' => $form->email, 'password' => $form->password, 'is_active' => true], $form->has('remember'));
if (!$attempt) {
flash()->error(trans('administr::auth.wrong_user_or_pass'));
return back();
}
return redirect()->intended(route('administr.dashboard.index'));
}
示例10: postLogin
/**
* @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');
}
示例11: postLogin
/**
* Handle a login request to the application.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function postLogin(Request $request)
{
$this->validate($request, ['email' => 'required|email|in:mr.jschauhan@gmail.com,fernandes.joyson@gmail.com,nikulshah2002@yahoo.com', 'password' => 'required']);
$credentials = $request->only('email', 'password');
if ($this->auth->attempt($credentials, $request->has('remember'))) {
return redirect()->intended($this->redirectPath());
}
return redirect($this->loginPath())->withInput($request->only('email', 'remember'))->withErrors(['email' => $this->getFailedLoginMessage()]);
}
示例12: byCredentials
/**
* @param array $credentials
*
* @param bool $remeber
*
* @return true
*/
public function byCredentials(array $credentials, $remeber = false)
{
$email = array_get($credentials, 'email');
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$credentials['username'] = $email;
unset($credentials['email']);
}
return $this->auth->attempt($credentials);
}
示例13: DoLogin
/**
* Handle a login request to the application.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function DoLogin(\Illuminate\Http\Request $request)
{
$this->validate($request, ['username' => 'required', 'password' => 'required']);
$credentials = $request->only('username', 'password');
if ($this->auth->attempt($credentials, $request->has('remember'))) {
return redirect('/settings');
}
return redirect()->action('Auth\\AuthController@ShowLogin')->withInput($request->only('username', 'remember', 'name'))->withErrors(['username' => 'These credentials do not match our records.']);
}
示例14: postLogin
/**
* Handle a login request to the application.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function postLogin(Request $request)
{
$this->validate($request, ['email' => 'required', 'password' => 'required']);
$credentials = $request->only('email', 'password');
if ($this->auth->attempt($credentials, $request->has('remember'))) {
return redirect()->intended($this->redirectPath());
}
return redirect($this->loginPath())->withInput($request->only('email', 'remember'))->withErrors(['email' => 'These credentials do not match our records.']);
}
示例15: attemptLogin
protected function attemptLogin(Request $request)
{
$credentials = ['email' => $request->get('email'), 'password' => $request->get('password')];
$rules = [];
$validator = Validator::make($credentials, $rules);
if ($validator->fails()) {
throw new \Exception('Fatal Error :: Validation Failed!!');
}
return $this->authManager->attempt($credentials) ? redirect('admin') : redirect('admin/login');
}