This commit is contained in:
Adrian Hopek 2022-03-21 13:53:33 +01:00
parent dafc17b14c
commit c5dffa60e9
3 changed files with 7 additions and 8 deletions

View File

@ -4,11 +4,18 @@ declare(strict_types=1);
namespace Toby\Eloquent\Observers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use Toby\Eloquent\Models\User;
use Toby\Eloquent\Models\YearPeriod;
class UserObserver
{
public function creating(User $user): void
{
$user->password = Hash::make(Str::random(40));
}
public function created(User $user): void
{
$yearPeriods = YearPeriod::all();

View File

@ -7,7 +7,6 @@ namespace Toby\Infrastructure\Http\Controllers;
use Illuminate\Contracts\Auth\Factory as AuthFactory;
use Illuminate\Contracts\Hashing\Hasher;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Str;
use Laravel\Socialite\SocialiteManager;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Toby\Eloquent\Models\User;
@ -36,9 +35,6 @@ class GoogleController extends Controller
]);
}
$user->update([
"password" => $hash->make(Str::random(40)),
]);
$auth->guard()->login($user, true);
return redirect()->route("dashboard");

View File

@ -12,10 +12,6 @@ class LogoutController extends Controller
{
public function __invoke(Request $request): RedirectResponse
{
$request->user()->update([
"password" => null,
]);
Auth::logout();
$request->session()->invalidate();