【发布时间】:2020-01-21 05:21:47
【问题描述】:
我在我的 Laravel 应用程序上使用了两个注册,默认的 Laravel 注册和 Laravel Socialite。两者都工作正常。当用户使用默认 Laravel 注册注册时,它会发送验证电子邮件,但它也会向 Laravel Socialite 发送验证电子邮件,我想禁用使用社交名流发送验证电子邮件但我不知道该怎么做。
这是我的Login Controller 中处理Socialite 的代码
public function redirectToGoogle()
{
return Socialite::driver('google')->redirect();
}
public function handleGoogleCallback()
{
try {
$user = Socialite::driver('google')->user();
$finduser = User::where('google_id', $user->id)->first();
if($finduser){
Auth::login($finduser);
return redirect('/home');
}else{
$newUser = User::create([
'name' => $user->name,
'email' => $user->email,
'google_id'=> $user->id
]);
Auth::login($newUser);
return redirect()->back();
}
} catch (Exception $e) {
return redirect('auth/google');
}
}
【问题讨论】:
-
我添加了
'email_verified_at' => date('Y-m-d H:i:s')来选择时间,但它不起作用 -
您需要在数据库表中将 'email_verified_at' 设置为 CURRENT_TIMESTAMP,而不是从这里传递。
标签: laravel