Skip to content

Commit

Permalink
fix logout (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thiritin authored Dec 22, 2023
2 parents c95bed8 + eae6dd6 commit e0404d0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
8 changes: 5 additions & 3 deletions app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public function view(Request $request)
* If skip is true do not show UI but simply accept
*/
if ($loginRequest["skip"] === true) {
return Redirect::to($hydra->acceptLogin($loginRequest['subject'], $loginRequest["challenge"], 0, $loginRequest));
return Redirect::to($hydra->acceptLogin($loginRequest['subject'], $loginRequest["challenge"], 0,
$loginRequest));
}

return Inertia::render('Auth/Login');
Expand All @@ -48,12 +49,13 @@ public function submit(LoginRequest $request)
if (Auth::attempt($loginData)) {
$user = Auth::user();
if ($user->hasVerifiedEmail() === false) {
Cache::put("web." . $user->id . ".loginChallenge", $request->get('login_challenge'), now()->addMinutes(10));
Cache::put("web.".$user->id.".loginChallenge", $request->get('login_challenge'), now()->addMinutes(10));
return Redirect::route('verification.notice');
}


$url = (new Client())->acceptLogin($user->hashId(), $request->get('login_challenge'), $request->get('remember') ? "2592000" : "0");
$url = (new Client())->acceptLogin($user->hashId(), $request->get('login_challenge'),
$request->get('remember') ? "2592000" : "0");
return Inertia::location($url);
}

Expand Down
2 changes: 1 addition & 1 deletion resources/js/Layouts/AppLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ export default {
methods: {
logout() {
window.location.href = '/oauth2/sessions/logout'
window.location.href = '/auth/logout'
},
toggleDarkMode() {
if (this.darkMode === false) {
Expand Down
1 change: 0 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@

// E-Mail First Sign Up
Route::prefix('auth')->group(function () {

Route::get('verify', [VerifyEmailController::class, 'view'])->middleware('auth')->name('verification.notice');
Route::get('verify/logout', [
VerifyEmailController::class,
Expand Down

0 comments on commit e0404d0

Please sign in to comment.