title: auto
des: auto note:auto
This commit is contained in:
@@ -92,6 +92,7 @@ export default function Validasi() {
|
||||
color="green"
|
||||
onClick={() => {
|
||||
onValid();
|
||||
// myConsole("ok")
|
||||
}}
|
||||
>
|
||||
Submit
|
||||
|
||||
@@ -5,12 +5,18 @@ import { getConfig } from "@/bin/config";
|
||||
import { unsealData } from "iron-session";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
import fs from "fs";
|
||||
import yaml from "yaml";
|
||||
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
|
||||
|
||||
export async function getToken() {
|
||||
const c = cookies().get("ssn");
|
||||
|
||||
const token = await unsealData(c?.value as string, {
|
||||
password: (await getConfig()).server.password,
|
||||
password: await config.server.password,
|
||||
});
|
||||
|
||||
return token
|
||||
const data = JSON.parse(token as any)
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function HomeView() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<pre>{JSON.stringify(token, null, 2)}</pre>
|
||||
{/* <pre>{JSON.stringify(token, null, 2)}</pre> */}
|
||||
<Title>Home</Title>
|
||||
<Text>Welcome, {token?.username}</Text>
|
||||
<Logout />
|
||||
|
||||
Reference in New Issue
Block a user