mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2026-01-04 05:40:15 +00:00
feat: handle logout events in nostr-login
This commit introduces handling for logout events in nostr-login across various pages. When a user logs out, the current public key and other related information are reset to null. The nostrLogin.js file has also been updated to dispatch a 'nostrLoggedOut' event when this occurs. Additionally, the nostr-login package has been added to the project dependencies.
This commit is contained in:
@@ -17,6 +17,13 @@ state(['isAllowed' => false]);
|
||||
state(['currentPubkey' => null]);
|
||||
state(['members' => []]);
|
||||
|
||||
on([
|
||||
'nostrLoggedOut' => function () {
|
||||
$this->isAllowed = false;
|
||||
$this->currentPubkey = null;
|
||||
},
|
||||
]);
|
||||
|
||||
on([
|
||||
'nostrLoggedIn' => function ($pubkey) {
|
||||
$this->currentPubkey = $pubkey;
|
||||
@@ -24,7 +31,7 @@ on([
|
||||
->where('pubkey', $pubkey)->first();
|
||||
$allowedPubkeys = [
|
||||
'0adf67475ccc5ca456fd3022e46f5d526eb0af6284bf85494c0dd7847f3e5033',
|
||||
'430169631f2f0682c60cebb4f902d68f0c71c498fd1711fd982f052cf1fd4279'
|
||||
'430169631f2f0682c60cebb4f902d68f0c71c498fd1711fd982f052cf1fd4279',
|
||||
];
|
||||
if (!in_array($this->currentPubkey, $allowedPubkeys, true)) {
|
||||
return redirect()->route('association.profile');
|
||||
|
||||
Reference in New Issue
Block a user