Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/BetterLectio/betterLectio in…
Browse files Browse the repository at this point in the history
…to dev
  • Loading branch information
victorDigital committed Nov 15, 2023
2 parents d76c0ef + ce0c4de commit 9a168d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "betterlectio",
"version": "0.10.122",
"version": "0.10.124",
"private": true,
"scripts": {
"dev": "vite dev",
Expand Down
10 changes: 9 additions & 1 deletion src/routes/+layout.server.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import { Redirect } from '@sveltejs/kit';

async function validCookie(base64Cookie) {
const cookies = await JSON.parse(await Buffer.from(base64Cookie, 'base64'));
const skoleId = cookies[await (await cookies.map(cookie => cookie.name)).indexOf('LastLoginExamno')].value;
const response = await fetch(`https://www.lectio.dk/lectio/${skoleId}/help/mainhelp.aspx`, { headers: { cookie: await (await cookies.map(cookie => `${cookie.name}=${cookie.value}`)).join('; ') } });

if ((await response.text()).split('Log ud').length > 1) return true;
return false;
}

/** @type {import('./$types').LayoutServerLoad} */
export async function load({ cookies, url }) {
// check cookies to check if user is logged in
// if not, redirect to /login

return {};
}

0 comments on commit 9a168d8

Please sign in to comment.