本文整理汇总了PHP中Authenticator::attempt方法的典型用法代码示例。如果您正苦于以下问题:PHP Authenticator::attempt方法的具体用法?PHP Authenticator::attempt怎么用?PHP Authenticator::attempt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authenticator
的用法示例。
在下文中一共展示了Authenticator::attempt方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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('/dash-board');
}
return redirect('/login')->withErrors(['email' => 'The credentials you entered did not match our records. Try again?']);
}
示例2: postLogin
public function postLogin(LoginRequest $request)
{
if ($this->auth->attempt($request->only('email', 'password'))) {
return redirect('/users/' . $request->user()->name);
}
return redirect('/auth/login')->withErrors(['email' => 'These credentials do not match our records.']);
}
示例3: postLogin
protected function postLogin(LoginRequest $request)
{
if ($this->auth->attempt($request->only('email', 'password'))) {
return redirect()->route('users');
}
return redirect('/')->withErrors(['error' => 'The email or the password is invalid. Please try again.']);
}
示例4: postLogin
/**
* Handle a login request to the application.
*
* @param LoginRequest $request
* @return Response
*/
public function postLogin(LoginRequest $request)
{
$user = User::where('username', '=', $request->username)->first();
if (isset($user)) {
if ($user->password == md5($request->password)) {
// If their password is still MD5
$user->password = bcrypt($request->password);
// Convert to new format
$user->save();
}
if ($user->confermato) {
$remember = null !== $request->get("remember-me") ? true : false;
if ($this->auth->attempt($request->only('username', 'password'), $remember)) {
if ($request->ajax()) {
return Response::json(array('code' => '200', 'msg' => 'OK'));
} else {
if ($this->auth->user()->ruolo == 1) {
return redirect('admin');
} else {
return redirect('/');
}
}
}
}
}
if ($request->ajax()) {
return Response::json(array('code' => '500', 'msg' => $this->getFailedLoginMessage()));
} else {
return redirect('/auth/login')->withErrors(['email' => $this->getFailedLoginMessage()]);
}
}
示例5: postLogin
public function postLogin(LoginRequest $request)
{
if ($this->auth->attempt($request->only('email', 'password', 'user_type'))) {
$user = \Auth::user();
if ($user->user_type == 1) {
return redirect('/homepage');
} elseif ($user->user_type == 2) {
return redirect('/student');
} elseif ($user->user_type == 3) {
return redirect('/dash-board');
}
//return view('dashboard', compact('user'));
} else {
return redirect('/auth/login')->withErrors(['email' => 'The credentials you entered did not match our records. Try again?']);
}
}
示例6: postLogin
/**
* Handle a login request to the application.
*
* @param LoginRequest $request
* @return Response
*/
public function postLogin(LoginRequest $request)
{
\Log::info("-----------------this is fucking working driver auth controller.php");
$a = array('email' => $request->input('email', 'email not found'), 'password' => $request->input('password', 'password not found'));
// $tasks = DB::select('SELECT * FROM tasks where user_id = 6;');
// \Log::info($tasks);
\Log::info("trying to attepm to loging");
\Log::info($a);
$b = $request->all();
\Log::info("all fields are");
\Log::info($b);
if ($this->auth->attempt($a)) {
\Log::info('.............log in successful.........');
$ownedBookList = DB::select('SELECT * FROM ownedbooklist where userId = ?;', [13]);
\Log::info($ownedBookList);
\Log::info('sending date to view');
// return redirect('user/login')->with('message', 'Login Failed');
return redirect('user/userhomepage');
}
/* if ($this->auth->attempt($request->only('email', 'password')))
{
return redirect('/tasks');
}
*/
\Log::info("login failed");
return redirect('auth/login')->withErrors(['email' => 'The credentials you entered did not match our records. Try again?']);
}
示例7: postRegister
protected function postRegister(RegisterRequest $request)
{
$this->user->email = $request->email;
$this->user->password = bcrypt($request->password);
$this->user->save();
if ($this->auth->attempt($request->only('email', 'password'))) {
return redirect()->intended('/account/vehicles/types');
}
}
示例8: postLogin
/**
* Handle a login request to the application.
*
* @param LoginRequest $request
* @return Response
*/
public function postLogin(LoginRequest $request)
{
$a = array('email' => $request->input('email', 'email not found'), 'password' => $request->input('password', 'password not found'));
$b = $request->all();
if ($this->auth->attempt($a)) {
$ownedBookList = DB::select('SELECT * FROM ownedbooklist where userId = ?;', [13]);
return redirect('userhomepage');
}
\Log::info("login failed");
return redirect('auth/login')->withErrors(['email' => 'The credentials you entered did not match our records. Try again?']);
}
示例9: postLogin
protected function postLogin(LoginRequest $request)
{
$checked = $request->input('remember');
//dd($this->auth->viaRemember());
if ($this->auth->viaRemember()) {
//Always false? Needs fix but "Remember Me" works!
return redirect()->route('dashboard');
} else {
//Then set remember as user opts!
if (isset($checked)) {
if ($this->auth->attempt($request->only('email', 'password'), true)) {
return redirect()->route('dashboard');
}
} else {
if ($this->auth->attempt($request->only('email', 'password'), false)) {
return redirect()->route('dashboard');
}
}
}
return redirect('users/login')->withErrors(['email' => 'The email or the password is invalid. Please try again.']);
}
示例10: postRegister
protected function postRegister(RegisterRequest $request)
{
//$this->user->name = $request->name;
$this->user->email = $request->email;
$this->user->password = bcrypt($request->password);
$this->user->is_admin = 0;
$this->user->role = 'E';
$this->user->save();
//return redirect('laravel_angular/users/login');
if ($this->auth->attempt($request->only('email', 'password'))) {
$user = $this->auth->user();
$employee = new Employee();
$employee->name = $request->name;
$employee->email = $request->email;
//$employee->contact_number = $request->contact_number;
//$employee->position = $request->position;
$employee->user_id = $user->id;
$employee->save();
return redirect()->route('dashboard')->with('name', $request->name);
}
}