I am using steam auth. Once a user authenticates in steam, he is redirected back to my form where I ask him for his username(my and steam username rules differ) and email(steam does not provide it).
The problem is that if input is invalid he is redirected back(via laravel request) but at that point all GET parameters from steam are lost and he needs to visit steam login page again.
Controller method that decides whether to redirect to steam or show my login form
public function steamLogin()
{
if ($this->steam->validate()) {
$info = $this->steam->getUserInfo();
if (!is_null($info)) {
$user = User::where('steam', $info->getSteamID64())->first();
if (is_null($user)) {
if (!Cache::has('steam_' . $info->getSteamID64())) {
Cache::put('steam_' . $info->getSteamID64(), $info, Carbon::now()->addMinutes(5));
}
return view('auth.steam', ['info' => $info]);
}
Auth::login($user, true);
return redirect('/');
}
}
return $this->steam->redirect();
}
It is taken off an example here
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire