diff options
| author | Lizzy Hunt <lizzy.hunt@usu.edu> | 2023-10-11 11:06:35 -0600 |
|---|---|---|
| committer | Lizzy Hunt <lizzy.hunt@usu.edu> | 2023-10-11 11:06:35 -0600 |
| commit | 7331da69aa3442d7edaed4160b5a6bd3239ed265 (patch) | |
| tree | 886b4ab68be0fff4b4da603563dec0a30a32b98b /src/session.js | |
| parent | 5a7f1ac4c9ec3044bef6dee6f7f6d7f51046526b (diff) | |
| download | aggietimed-7331da69aa3442d7edaed4160b5a6bd3239ed265.tar.gz aggietimed-7331da69aa3442d7edaed4160b5a6bd3239ed265.zip | |
allow cookie on stdin
Diffstat (limited to 'src/session.js')
| -rw-r--r-- | src/session.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/session.js b/src/session.js index 42a8617..d55b772 100644 --- a/src/session.js +++ b/src/session.js @@ -21,6 +21,9 @@ export const refresh_jwt = () => { return aggietime.get_user_info(); }; +export const setCookie = (jwt) => + jar.setCookie(`${AGGIETIME_AUTH_COOKIE_NAME}=${jwt}`, AGGIETIME_URI); + export const logout = () => client.get(`${AGGIETIME_URI}/${LOGOUT_PATH}`); export const login = async (a_number, password) => { @@ -47,8 +50,8 @@ export const login = async (a_number, password) => { console.log("Waiting until password field is located..."); await Promise.all( [SAML_PASSWORD_SELECTOR, SAML_SUBMIT_SELECTOR].map((selector) => - driver.wait(until.elementLocated(By.css(selector))) - ) + driver.wait(until.elementLocated(By.css(selector))), + ), ); console.log("Filling password..."); @@ -66,7 +69,7 @@ export const login = async (a_number, password) => { } await driver.wait( - until.urlContains(AGGIETIME_URL_CONTAINS_SIGNIFIES_AUTH_COMPLETE) + until.urlContains(AGGIETIME_URL_CONTAINS_SIGNIFIES_AUTH_COMPLETE), ); console.log("Retrieving cookie..."); @@ -77,7 +80,7 @@ export const login = async (a_number, password) => { ...cookie, key: cookie.name, }), - AGGIETIME_URI + AGGIETIME_URI, ); console.log("Got it!"); } finally { |
