🐛 Fix redirect missing search parameters

This commit is contained in:
LittleSheep 2024-02-05 22:47:07 +08:00
parent 902650f11d
commit 922fa45fa7
2 changed files with 7 additions and 5 deletions

View File

@ -15,6 +15,10 @@ func preConnect(c *fiber.Ctx) error {
id := c.Query("client_id")
redirect := c.Query("redirect_uri")
if len(id) <= 0 || len(redirect) <= 0 {
return fiber.NewError(fiber.StatusBadRequest, "invalid request, missing query parameters")
}
var client models.ThirdClient
if err := database.C.Where(&models.ThirdClient{Alias: id}).First(&client).Error; err != nil {
return fiber.NewError(fiber.StatusNotFound, err.Error())

View File

@ -2,7 +2,7 @@ import Navbar from "./shared/Navbar.tsx";
import { readProfiles, useUserinfo } from "../stores/userinfo.tsx";
import { createEffect, createSignal, Show } from "solid-js";
import { readWellKnown } from "../stores/wellKnown.tsx";
import { BeforeLeaveEventArgs, useBeforeLeave, useLocation, useNavigate } from "@solidjs/router";
import { BeforeLeaveEventArgs, useLocation, useNavigate } from "@solidjs/router";
export default function RootLayout(props: any) {
const [ready, setReady] = createSignal(false);
@ -16,9 +16,9 @@ export default function RootLayout(props: any) {
createEffect(() => {
if (ready()) {
keepGate(location.pathname);
keepGate(location.pathname + location.search);
}
}, [ready, userinfo]);
}, [ready, userinfo, location]);
function keepGate(path: string, e?: BeforeLeaveEventArgs) {
const pathname = path.split("?")[0];
@ -30,8 +30,6 @@ export default function RootLayout(props: any) {
}
}
useBeforeLeave((e: BeforeLeaveEventArgs) => keepGate(e.to.toString(), e));
return (
<Show when={ready()} fallback={
<div class="h-screen w-screen flex justify-center items-center">