-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Motivation
No, I don't want to email myself 😄
Testing if a user is logged in?
document.querySelector('a.nomelogin')If null, it is not. Otherwise, the returned element will be <a>. Get the href attribute and parse the query parameter pct_id=<other_id>. The complete URL looks like this: https://sigarra.up.pt/feup/pt/vld_entidades_geral.entidade_pagina?pct_id=<other_id>

Getting the real user-id
For whatever reason, the ID used in the logged in user does not match the actual user identifier. It will be necessary to make a GET request for that hyperlink. The response is actually a redirect, notice the <meta http-equiv="Refresh">:
For students:
<html><head>
<meta http-equiv="Refresh" content="0;url=https://sigarra.up.pt/feup/pt/fest_geral.cursos_list?pv_num_unico=<id>">
<meta HTTP-EQUIV="Pragma" content="no-cache">
<meta name="ROBOTS" content="NOINDEX">
<a href="https://sigarra.up.pt/feup/pt/fest_geral.cursos_list?pv_num_unico=<id>"></a>
</head><body></body></html>For staff:
<html><head>
<meta http-equiv="Refresh" content="0;url=https://sigarra.up.pt/feup/pt/func_geral.formview?p_codigo=<id>">
<meta HTTP-EQUIV="Pragma" content="no-cache">
<meta name="ROBOTS" content="NOINDEX">
<a href="https://sigarra.up.pt/feup/pt/func_geral.formview?p_codigo=<id>"></a>
</head><body></body></html>Given the response, perhaps use the DOMParser and then make a query selector for <a> and parse the href.
Caching
It will be helpful to store a mapping of other_id to id to prevent requests on every new page load.
