mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2025-12-14 12:06:46 +00:00
🔒 Add fallback user creation for first-time logins and enhance redirect consistency
- 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.
This commit is contained in:
@@ -67,7 +67,33 @@ class extends Component {
|
|||||||
Auth::loginUsingId($user->id);
|
Auth::loginUsingId($user->id);
|
||||||
Session::regenerate();
|
Session::regenerate();
|
||||||
$this->redirectIntended(
|
$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,
|
navigate: true,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@@ -93,8 +119,10 @@ class extends Component {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$this->redirectIntended(
|
$this->redirectIntended(
|
||||||
default: route('dashboard', ['country' => str(session('lang_country', config('app.domain_country')))->after('-')->lower()], absolute: false),
|
default: route('dashboard',
|
||||||
navigate: true
|
['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,
|
'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;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user