Merge branch 'main' into #4-users-crud

# Conflicts:
#	.env.example
#	app/Http/Controllers/GoogleController.php
#	app/Http/Middleware/Authenticate.php
#	app/Http/Resources/UserResource.php
#	app/Models/User.php
#	composer.lock
#	database/factories/UserFactory.php
#	database/migrations/2014_10_12_000000_create_users_table.php
#	package-lock.json
#	package.json
#	resources/js/Pages/Login.vue
#	resources/js/Shared/Layout/GuestLayout.vue
#	resources/js/Shared/MainMenu.vue
#	resources/js/app.js
#	resources/lang/pl.json
#	routes/web.php
This commit is contained in:
Adrian Hopek 2022-01-18 10:06:53 +01:00
commit d7d84a1b30
4 changed files with 8 additions and 7 deletions

View File

@ -26,10 +26,6 @@ class GoogleController extends Controller
$user = User::query() $user = User::query()
->where("email", $socialUser->getEmail()) ->where("email", $socialUser->getEmail())
->firstOrFail(); ->firstOrFail();
$auth->guard()->login($user, true);
return redirect()->route("dashboard");
} catch (ModelNotFoundException) { } catch (ModelNotFoundException) {
return redirect() return redirect()
->route("login") ->route("login")
@ -37,5 +33,9 @@ class GoogleController extends Controller
"oauth" => __("User does not exist."), "oauth" => __("User does not exist."),
]); ]);
} }
$auth->guard()->login($user, true);
return redirect()->route("dashboard");
} }
} }

View File

@ -8,7 +8,7 @@ use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware class Authenticate extends Middleware
{ {
protected function redirectTo($request): ?string protected function redirectTo($request): string
{ {
return route("login"); return route("login");
} }

View File

@ -1,4 +1,5 @@
<template> <template>
<InertiaHead title="Zaloguj się" />
<transition <transition
enter-active-class="transform ease-out duration-300 transition" enter-active-class="transform ease-out duration-300 transition"
enter-from-class="translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2" enter-from-class="translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2"
@ -21,7 +22,7 @@
</div> </div>
<div class="ml-4 flex-shrink-0 flex"> <div class="ml-4 flex-shrink-0 flex">
<button <button
class="bg-red-500 rounded-md inline-flex text-red-100 hover:text-red-400 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blumilk-500" class="bg-red-500 rounded-md inline-flex text-red-100 hover:text-red-400 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-600"
@click="delete errors.oauth" @click="delete errors.oauth"
> >
<span class="sr-only">Close</span> <span class="sr-only">Close</span>

View File

@ -9,4 +9,4 @@
export default { export default {
name: 'GuestLayout', name: 'GuestLayout',
}; };
</script> </script>