Skip to content

Commit

Permalink
ensure user existence is checked before trying to get its username
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardobl committed Jun 25, 2024
1 parent db00daf commit 6ceed37
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Http/Controllers/LnAddressController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ public function __construct()
public function handleLnurlp($addr)
{
$user = User::fromLightningAddress($addr);
$username = $user->username;

if (! $user) {
return response()->json(['status' => 'ERROR', 'reason' => 'User not found'], 404);
}

$username = $user->username;

$callbackUrl = url("/lnurlp/callback?user={$username}");
$metadata = json_encode([['text/plain', "Test! Payment to {$username}"]]);

Expand Down

0 comments on commit 6ceed37

Please sign in to comment.