Closed ImChiip closed 8 years ago
I solved this a different way in Laravel 5.2, and added some IP logging too.
public function login()
{
if ($this->steam->validate()) {
$info = $this->steam->getUserInfo();
if (!is_null($info)) {
$user = User::where('steamid', $info->getSteamID64())->first();
if (!is_null($user)) {
Auth::login($user, true);
$user->ip_address = Request::getClientIp();
$user->save();
return self::redirectvalid();
} else {
$userIP = Request::getClientIp();
$user = User::create([
'name' => $info->getNick(),
'steamid' => $info->getSteamID64(),
'ip_address' => $userIP,
]);
$user->uid = User::generateUUID($user->id);
$user->save();
Auth::login($user, true);
return self::redirectvalid();
}
}
} else {
return $this->steam->redirect(); // redirect to Steam login page
}
}
public function redirectvalid() {
$playerUID = User::where('uid', '=', Auth::user()->uid)->first();
return redirect('/player/'. $playerUID->uid); // redirect to site
}
Hello, I am trying to build a site for my server altis life I use your library with Laravel 5.2 I noticed a bug with the addition of a new user when a new user is recorded via the Steam user was recording well in DB but redirect flaunted the middleware error auth In the I just removed the $ user of User :: create and I redo a request for a $ retrieved information with a new DB queries
I can make a pull request if it suits you
Sorry I do not speak much English
Sincerely yours, Arnaud C