From 00576794f611c4b178a2b2e2fbc9a8604064d71b Mon Sep 17 00:00:00 2001 From: HolgerHatGarKeineNode Date: Sun, 23 Nov 2025 23:19:57 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=92=20Add=20fallback=20user=20creation?= =?UTF-8?q?=20for=20first-time=20logins=20and=20enhance=20redirect=20consi?= =?UTF-8?q?stency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Implemented automatic creation of fallback users with default properties during login if no existing user is found. - Standardized the redirect logic for the dashboard route with consistent parameter handling. - Improved readability of route definitions by formatting parameters across multiple lines. --- resources/views/livewire/auth/login.blade.php | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/resources/views/livewire/auth/login.blade.php b/resources/views/livewire/auth/login.blade.php index 6d7c70c..b5e750a 100644 --- a/resources/views/livewire/auth/login.blade.php +++ b/resources/views/livewire/auth/login.blade.php @@ -67,7 +67,33 @@ class extends Component { Auth::loginUsingId($user->id); Session::regenerate(); $this->redirectIntended( - default: route('dashboard', ['country' => str(session('lang_country', config('app.domain_country')))->after('-')->lower()], absolute: false), + default: route('dashboard', + ['country' => str(session('lang_country', config('app.domain_country')))->after('-')->lower()], + absolute: false), + navigate: true, + ); + return; + } else { + $fakeName = str()->random(10); + // create User + $user = User::create([ + 'public_key' => null, + 'is_lecturer' => true, + 'name' => $fakeName, + 'email' => str($pubkey)->substr(-12).'@portal.einundzwanzig.space', + 'nostr' => $pubkey, + 'lnbits' => [ + 'read_key' => null, + 'url' => null, + 'wallet_id' => null, + ], + ]); + Auth::loginUsingId($user->id); + Session::regenerate(); + $this->redirectIntended( + default: route('dashboard', + ['country' => str(session('lang_country', config('app.domain_country')))->after('-')->lower()], + absolute: false), navigate: true, ); return; @@ -93,8 +119,10 @@ class extends Component { ]); $this->redirectIntended( - default: route('dashboard', ['country' => str(session('lang_country', config('app.domain_country')))->after('-')->lower()], absolute: false), - navigate: true + default: route('dashboard', + ['country' => str(session('lang_country', config('app.domain_country')))->after('-')->lower()], + absolute: false), + navigate: true, ); } @@ -145,7 +173,8 @@ class extends Component { 'lang_country' => $this->currentLangCountry, ]); - return to_route('dashboard', ['country' => str(session('lang_country', config('app.domain_country')))->after('-')->lower()]); + return to_route('dashboard', + ['country' => str(session('lang_country', config('app.domain_country')))->after('-')->lower()]); } return true;