Daten weg im Bestellptozess nach Passwort anfordern. Joachim Weggler
Nachdem ein neues Passwort angefragt wurde wird der Kunde nun automatisch zurück zum Formular geleitet.
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
try {
|
||||
sent = true
|
||||
const response = await api.auth["passwort-vergessen"].GET.fetch({
|
||||
redirect,
|
||||
email
|
||||
})
|
||||
|
||||
@@ -57,7 +58,7 @@
|
||||
{#if showEmailSuccess}
|
||||
<div class="flex-row justify-between" style="margin-top: 10px">
|
||||
<a class="link link-hover"
|
||||
href="/auth/login{redirect ? `?redirect=${redirect}` : ""}">Einloggen</a
|
||||
href="/auth/login{redirect ? `?r=${redirect}` : ""}">Einloggen</a
|
||||
>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
let passwortWiederholen: string;
|
||||
|
||||
export let token: string;
|
||||
export let redirect: string | null = null;
|
||||
|
||||
let disabled = false;
|
||||
|
||||
@@ -28,7 +29,7 @@
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
window.location.href = "/auth/login"
|
||||
window.location.href = "/auth/login?r=" + encodeURIComponent(redirect ?? "/dashboard")
|
||||
}, 5000)
|
||||
} catch (e) {
|
||||
disabled = false
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<button class="button" type="submit">Einloggen</button>
|
||||
<div class="flex flex-row justify-between" style="margin-top: 10px">
|
||||
<a on:click={() => navigate("signup")} class="cursor-pointer" data-cy="registrieren">Registrieren</a>
|
||||
<a href="/user/passwort_vergessen">Passwort Vergessen?</a>
|
||||
<a href="/auth/passwort-vergessen?r={window.location.href}">Passwort Vergessen?</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
<button class="button" type="submit">Registrieren</button>
|
||||
<div class="flex-row justify-between" style="margin-top: 10px">
|
||||
<button on:click={() => navigate("login")}>Einloggen</button>
|
||||
<a href="/user/passwort_vergessen">Passwort Vergessen?</a>
|
||||
<a href="/auth/passwort-vergessen?r={window.location.href}">Passwort Vergessen?</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -62,9 +62,9 @@
|
||||
</div>
|
||||
{/if}
|
||||
<button class="button" type="submit">Einloggen</button>
|
||||
<div class="flex-row justify-between" style="margin-top: 10px">
|
||||
<a class="link link-hover" href="/auth/signup{redirect ? `?redirect=${redirect}` : ""}">Registrieren</a>
|
||||
<a class="link link-hover" href="/auth/passwort-vergessen{redirect ? `?redirect=${redirect}` : ""}"
|
||||
<div class="flex flex-row justify-between" style="margin-top: 10px">
|
||||
<a class="link link-hover" href="/auth/signup{redirect ? `?r=${redirect}` : ""}">Registrieren</a>
|
||||
<a class="link link-hover" href="/auth/passwort-vergessen{redirect ? `?r=${redirect}` : ""}"
|
||||
>Passwort Vergessen?</a
|
||||
>
|
||||
</div>
|
||||
|
||||
@@ -128,11 +128,11 @@
|
||||
<button type="submit" class="button"
|
||||
>Registrieren</button
|
||||
>
|
||||
<div class="flex-row justify-between" style="margin-top: 10px">
|
||||
<div class="flex flex-row justify-between" style="margin-top: 10px">
|
||||
<a class="link link-hover"
|
||||
href="/auth/login{redirect ? `?redirect=${redirect}` : ""}">Einloggen</a
|
||||
href="/auth/login{redirect ? `?r=${redirect}` : ""}">Einloggen</a
|
||||
>
|
||||
<a class="link link-hover" href="/auth/passwort-vergessen{redirect ? `?redirect=${redirect}` : ""}">Passwort Vergessen?</a>
|
||||
<a class="link link-hover" href="/auth/passwort-vergessen{redirect ? `?r=${redirect}` : ""}">Passwort Vergessen?</a>
|
||||
</div>
|
||||
</form>
|
||||
<NotificationWrapper></NotificationWrapper>
|
||||
|
||||
@@ -20,7 +20,7 @@ const user = await getCurrentUser(Astro)
|
||||
if (id) {
|
||||
if (!user) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ if (id) {
|
||||
} else if (aufnahme_id) {
|
||||
if (!user) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ const user = await getCurrentUser(Astro)
|
||||
if (id) {
|
||||
if (!user) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ if (id) {
|
||||
} else if (aufnahme_id) {
|
||||
if (!user) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ const user = await getCurrentUser(Astro)
|
||||
if (id) {
|
||||
if (!user) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ if (id) {
|
||||
} else if (aufnahme_id) {
|
||||
if (!user) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ let loadFromDatabase = false;
|
||||
|
||||
if (typ === AusstellungsTyp.Neuausstellung) {
|
||||
if (!user) {
|
||||
return Astro.redirect(`/auth/login?redirect=${Astro.url.toString()}`);
|
||||
return Astro.redirect(`/auth/login?r=${Astro.url.toString()}`);
|
||||
}
|
||||
|
||||
if (!ausweis_id) {
|
||||
@@ -115,7 +115,7 @@ if (typ === AusstellungsTyp.Neuausstellung) {
|
||||
loadFromDatabase = true;
|
||||
} else if (typ === AusstellungsTyp.Speichern) {
|
||||
if (!user) {
|
||||
return Astro.redirect(`/auth/login?redirect=${Astro.url.toString()}`);
|
||||
return Astro.redirect(`/auth/login?r=${Astro.url.toString()}`);
|
||||
}
|
||||
|
||||
if (!ausweis_id) {
|
||||
@@ -151,7 +151,7 @@ if (typ === AusstellungsTyp.Neuausstellung) {
|
||||
loadFromDatabase = true;
|
||||
} else if (typ === AusstellungsTyp.Alternativdokument) {
|
||||
if (!user) {
|
||||
return Astro.redirect(`/auth/login?redirect=${Astro.url.toString()}`);
|
||||
return Astro.redirect(`/auth/login?r=${Astro.url.toString()}`);
|
||||
}
|
||||
|
||||
if (!ausweis_id) {
|
||||
|
||||
@@ -20,7 +20,7 @@ const user = await getCurrentUser(Astro)
|
||||
if (id) {
|
||||
if (!user) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ if (id) {
|
||||
} else if (aufnahme_id) {
|
||||
if (!user) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ const user = await getCurrentUser(Astro)
|
||||
if (id) {
|
||||
if (!user) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ if (id) {
|
||||
} else if (aufnahme_id) {
|
||||
if (!user) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ const user = await getCurrentUser(Astro)
|
||||
if (id) {
|
||||
if (!user) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ if (id) {
|
||||
} else if (aufnahme_id) {
|
||||
if (!user) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ import { transport } from "#lib/mail.js";
|
||||
|
||||
export const GET = defineApiRoute({
|
||||
input: z.object({
|
||||
email: z.string().email()
|
||||
email: z.string().email(),
|
||||
redirect: z.string().optional()
|
||||
}),
|
||||
output: z.void(),
|
||||
async fetch(input, context, transfer) {
|
||||
@@ -42,7 +43,7 @@ export const GET = defineApiRoute({
|
||||
|
||||
sie haben eine Anfrage zum Zurücksetzen ihres Passworts gestellt. Klicken sie auf den folgenden Link, um ein neues Passwort festzulegen:
|
||||
|
||||
https://online-energieausweis.org/auth/passwort-zuruecksetzen?t=${resetToken}
|
||||
https://online-energieausweis.org/auth/passwort-zuruecksetzen?t=${resetToken}${input.redirect ? `&r=${input.redirect}` : ""}
|
||||
|
||||
Dieser Link ist für die nächsten 15 Minuten gültig. Falls du diese Anfrage nicht gestellt hast, kannst du diese E-Mail ignorieren - dein Passwort bleibt unverändert.
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
---
|
||||
import BlankLayout from "#layouts/BlankLayout.astro";
|
||||
import EmbeddedLoginModule from "#modules/EmbeddedLoginModule.svelte";
|
||||
|
||||
---
|
||||
|
||||
<BlankLayout title="Login - IBCornelsen">
|
||||
<EmbeddedLoginModule client:only></EmbeddedLoginModule>
|
||||
</BlankLayout>
|
||||
@@ -1,10 +0,0 @@
|
||||
---
|
||||
import BlankLayout from "#layouts/BlankLayout.astro";
|
||||
import EmbeddedRegisterModule from "#modules/EmbeddedRegisterModule.svelte";
|
||||
|
||||
const redirect = Astro.url.searchParams.get("redirect");
|
||||
---
|
||||
|
||||
<BlankLayout title="Registrieren - IBCornelsen">
|
||||
<EmbeddedRegisterModule client:only></EmbeddedRegisterModule>
|
||||
</BlankLayout>
|
||||
@@ -9,7 +9,7 @@ if (valid) {
|
||||
return Astro.redirect("/dashboard")
|
||||
}
|
||||
|
||||
const redirect = Astro.url.searchParams.get("redirect")
|
||||
const redirect = Astro.url.searchParams.get("r")
|
||||
---
|
||||
|
||||
<MinimalLayout title="Login">
|
||||
|
||||
@@ -5,11 +5,13 @@ import MinimalLayout from "#layouts/MinimalLayout.astro";
|
||||
|
||||
const valid = await validateAccessTokenServer(Astro)
|
||||
|
||||
// Es kann sein, dass ein Nutzer von dem Ausweisformular kommt und sein Passwort vergessen hat.
|
||||
// In dem Fall sollte er auch auf das Formular zurückgeleitet werden wenn er sein Passwort zurückgesetzt hat.
|
||||
const redirect = Astro.url.searchParams.get("r")
|
||||
|
||||
if (valid) {
|
||||
return Astro.redirect("/dashboard")
|
||||
}
|
||||
|
||||
const redirect = Astro.url.searchParams.get("redirect")
|
||||
---
|
||||
|
||||
<MinimalLayout title="Passwort Vergessen">
|
||||
|
||||
@@ -12,6 +12,7 @@ if (valid) {
|
||||
}
|
||||
|
||||
const token = Astro.url.searchParams.get("t")
|
||||
const redirect = Astro.url.searchParams.get("r")
|
||||
|
||||
if (!token) {
|
||||
return Astro.redirect("/")
|
||||
@@ -25,5 +26,5 @@ if (!decoded.exp || decoded.exp < Date.now() || decoded.typ !== TokenType.Reset)
|
||||
---
|
||||
|
||||
<MinimalLayout title="Passwort Vergessen">
|
||||
<PasswortZuruecksetzenModule token={token} client:load></PasswortZuruecksetzenModule>
|
||||
<PasswortZuruecksetzenModule token={token} redirect={redirect} client:load></PasswortZuruecksetzenModule>
|
||||
</MinimalLayout>
|
||||
|
||||
@@ -9,7 +9,7 @@ if (valid) {
|
||||
return Astro.redirect("/dashboard")
|
||||
}
|
||||
|
||||
const redirect = Astro.url.searchParams.get("redirect");
|
||||
const redirect = Astro.url.searchParams.get("r");
|
||||
|
||||
|
||||
---
|
||||
|
||||
@@ -57,4 +57,5 @@ if (result.length > 0) {
|
||||
return Astro.redirect("/dashboard/objekte/leer");
|
||||
}
|
||||
|
||||
|
||||
---
|
||||
@@ -59,7 +59,7 @@ let loadFromDatabase = false;
|
||||
|
||||
if (typ === AusstellungsTyp.Neuausstellung) {
|
||||
if (!user) {
|
||||
return Astro.redirect(`/auth/login?redirect=${Astro.url.toString()}`);
|
||||
return Astro.redirect(`/auth/login?r=${Astro.url.toString()}`);
|
||||
}
|
||||
|
||||
if (!ausweis_id) {
|
||||
@@ -117,7 +117,7 @@ if (typ === AusstellungsTyp.Neuausstellung) {
|
||||
loadFromDatabase = true;
|
||||
} else if (typ === AusstellungsTyp.Speichern) {
|
||||
if (!user) {
|
||||
return Astro.redirect(`/auth/login?redirect=${Astro.url.toString()}`);
|
||||
return Astro.redirect(`/auth/login?r=${Astro.url.toString()}`);
|
||||
}
|
||||
|
||||
if (!ausweis_id) {
|
||||
@@ -154,7 +154,7 @@ if (typ === AusstellungsTyp.Neuausstellung) {
|
||||
loadFromDatabase = true;
|
||||
} else if (typ === AusstellungsTyp.Alternativdokument) {
|
||||
if (!user) {
|
||||
return Astro.redirect(`/auth/login?redirect=${Astro.url.toString()}`);
|
||||
return Astro.redirect(`/auth/login?r=${Astro.url.toString()}`);
|
||||
}
|
||||
|
||||
if (!ausweis_id) {
|
||||
|
||||
@@ -20,7 +20,7 @@ const caller = createCaller(Astro);
|
||||
if (uid) {
|
||||
if (!valid) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ const caller = createCaller(Astro);
|
||||
if (uid) {
|
||||
if (!valid) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ const caller = createCaller(Astro);
|
||||
if (uid) {
|
||||
if (!valid) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ const caller = createCaller(Astro);
|
||||
if (uid) {
|
||||
if (!valid) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ const caller = createCaller(Astro);
|
||||
if (uid) {
|
||||
if (!valid) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ const caller = createCaller(Astro);
|
||||
if (uid) {
|
||||
if (!valid) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
`/auth/login?r=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user