summaryrefslogtreecommitdiff
path: root/school/node_modules/pronote-api/src/cas/laclasse.js
blob: ea1d5d3801464d82bd745c1bbb5b3a1e48749836 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const { getDOM, getParams, extractStart } = require('./api');

const LOGIN_URL = 'https://www.laclasse.com/sso/login';

async function login(url, account, username, password)
{
    const service = encodeURIComponent(url);

    return extractStart(await getDOM({
        url: LOGIN_URL,
        method: 'POST',
        data: {
            service,
            state: getParams(await getDOM({ url: `${LOGIN_URL}?service=${service}` })).state,
            username,
            password
        },
        asIs: true
    }));
}

module.exports = login;