mirror of
https://github.com/versia-pub/frontend.git
synced 2026-01-26 04:16:02 +01:00
fix: 🐛 Fix broken auth consent flow
Some checks failed
Some checks failed
This commit is contained in:
parent
7ae35b2cf0
commit
d01aa22477
|
|
@ -29,13 +29,15 @@ definePageMeta({
|
||||||
});
|
});
|
||||||
|
|
||||||
const code = useRequestURL().searchParams.get("code");
|
const code = useRequestURL().searchParams.get("code");
|
||||||
const domain = useRequestURL().searchParams.get("domain");
|
const domain = useRoute().params.domain as string;
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
|
|
||||||
if (code && domain) {
|
if (code && domain) {
|
||||||
const newOrigin = new URL(`https://${domain}`);
|
const newOrigin = new URL(`https://${domain}`);
|
||||||
|
|
||||||
await authStore.finishSignIn(code, newOrigin);
|
await authStore.finishSignIn(code, newOrigin);
|
||||||
await navigateTo("/");
|
await navigateTo("/", {
|
||||||
|
external: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -5,21 +5,17 @@
|
||||||
backgroundImage: 'url(/images/banner.webp)',
|
backgroundImage: 'url(/images/banner.webp)',
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<form
|
<form method="GET" :action="redirectUri" class="w-full max-w-md">
|
||||||
method="POST"
|
|
||||||
:action="url.pathname.replace('/oauth/consent', '/oauth/authorize')"
|
|
||||||
class="w-full max-w-md"
|
|
||||||
>
|
|
||||||
<Card class="*:w-full p-6">
|
<Card class="*:w-full p-6">
|
||||||
|
<input type="hidden" name="code" :value="params.code">
|
||||||
<input
|
<input
|
||||||
type="hidden"
|
type="hidden"
|
||||||
v-for="[key, value] in url.searchParams"
|
v-if="params.state"
|
||||||
:key="key"
|
name="state"
|
||||||
:name="key"
|
:value="params.state"
|
||||||
:value="value"
|
|
||||||
>
|
>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle as="h1" class="text-2xl break-words">
|
<CardTitle as="h1" class="text-2xl wrap-break-word">
|
||||||
{{
|
{{
|
||||||
m.fresh_broad_cockroach_radiate({
|
m.fresh_broad_cockroach_radiate({
|
||||||
application: application ?? "",
|
application: application ?? "",
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ export const useAuthStore = defineStore("auth", {
|
||||||
origin: URL,
|
origin: URL,
|
||||||
): Promise<z.infer<typeof CredentialApplication>> {
|
): Promise<z.infer<typeof CredentialApplication>> {
|
||||||
const redirectUri = new URL(
|
const redirectUri = new URL(
|
||||||
`/callback?${new URLSearchParams({ domain: origin.host }).toString()}`,
|
`/callback/${origin.host}`,
|
||||||
useRequestURL().origin,
|
useRequestURL().origin,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue