-
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.
Merge branch 'dev' of https://github.com/BetterLectio/betterLectio in…
…to dev
- Loading branch information
Showing
2 changed files
with
10 additions
and
2 deletions.
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
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 {}; | ||
} |