Login System + API

This commit is contained in:
Moritz Utcke
2023-03-25 19:51:35 +04:00
parent dcbdf0e8d0
commit 5285f832bf
19 changed files with 551 additions and 7 deletions

17
src/pages/login.astro Normal file
View File

@@ -0,0 +1,17 @@
---
import moment from "moment";
import LoginView from "../components/LoginView.svelte";
import Layout from "../layouts/Layout.astro";
const token = Astro.cookies.get("token").value;
const expires = Astro.cookies.get("expires").number();
const now = moment().unix();
if (token && now < expires) {
return Astro.redirect("/user");
}
---
<Layout title="Login">
<LoginView client:only></LoginView>
</Layout>