-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 {}; | ||
} |
39d59f7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OMG
Nice