mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
ln auth added
This commit is contained in:
@@ -66,10 +66,10 @@
|
|||||||
<a class="underline text-sm text-gray-600 hover:text-gray-900" href="{{ route('login') }}">
|
<a class="underline text-sm text-gray-600 hover:text-gray-900" href="{{ route('login') }}">
|
||||||
{{ __('Already registered?') }}
|
{{ __('Already registered?') }}
|
||||||
</a>
|
</a>
|
||||||
|
Wurde noch nicht implementiert
|
||||||
<x-jet-button class="ml-4">
|
{{--<x-jet-button class="ml-4">
|
||||||
{{ __('Register') }}
|
{{ __('Register') }}
|
||||||
</x-jet-button>
|
</x-jet-button>--}}
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</x-jet-authentication-card>
|
</x-jet-authentication-card>
|
||||||
|
|||||||
@@ -17,3 +17,32 @@ use Illuminate\Support\Facades\Route;
|
|||||||
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
|
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
|
||||||
return $request->user();
|
return $request->user();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::get('/lnurl-auth-callback', function (\Illuminate\Http\Request $request) {
|
||||||
|
if (lnurl\auth($request->k1, $request->signature, $request->wallet_public_key)) {
|
||||||
|
// find User by $wallet_public_key
|
||||||
|
$user = User::where('public_key', $request->key)
|
||||||
|
->first();
|
||||||
|
if (!$user) {
|
||||||
|
// create User
|
||||||
|
$user = User::create([
|
||||||
|
'public_key' => $request->wallet_public_key,
|
||||||
|
'is_lecturer' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
// check if $k1 is in the database, if not, add it
|
||||||
|
$loginKey = LoginKey::where('k1', $request->k1)
|
||||||
|
->first();
|
||||||
|
if (!$loginKey) {
|
||||||
|
LoginKey::create([
|
||||||
|
'k1' => $request->k1,
|
||||||
|
'user_id' => $user->id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['status' => 'OK']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['status' => 'ERROR', 'reason' => 'Signature was NOT VERIFIED']);
|
||||||
|
})
|
||||||
|
->name('auth.ln.callback');
|
||||||
|
|||||||
@@ -24,35 +24,6 @@ Route::get('/', function () {
|
|||||||
Route::get('/auth/ln', \App\Http\Livewire\Auth\LNUrlAuth::class)
|
Route::get('/auth/ln', \App\Http\Livewire\Auth\LNUrlAuth::class)
|
||||||
->name('auth.ln');
|
->name('auth.ln');
|
||||||
|
|
||||||
Route::get('/lnurl-auth-callback', function (\Illuminate\Http\Request $request) {
|
|
||||||
if (lnurl\auth($request->k1, $request->signature, $request->wallet_public_key)) {
|
|
||||||
// find User by $wallet_public_key
|
|
||||||
$user = User::where('public_key', $request->key)
|
|
||||||
->first();
|
|
||||||
if (!$user) {
|
|
||||||
// create User
|
|
||||||
$user = User::create([
|
|
||||||
'public_key' => $request->wallet_public_key,
|
|
||||||
'is_lecturer' => true,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
// check if $k1 is in the database, if not, add it
|
|
||||||
$loginKey = LoginKey::where('k1', $request->k1)
|
|
||||||
->first();
|
|
||||||
if (!$loginKey) {
|
|
||||||
LoginKey::create([
|
|
||||||
'k1' => $request->k1,
|
|
||||||
'user_id' => $user->id,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return response()->json(['status' => 'OK']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return response()->json(['status' => 'ERROR', 'reason' => 'Signature was NOT VERIFIED']);
|
|
||||||
})
|
|
||||||
->name('auth.ln.callback');
|
|
||||||
|
|
||||||
Route::get('/{country:code}/suche/stadt', \App\Http\Livewire\Frontend\SearchCity::class)
|
Route::get('/{country:code}/suche/stadt', \App\Http\Livewire\Frontend\SearchCity::class)
|
||||||
->name('search.city');
|
->name('search.city');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user