Skip to content

Skip logged-in user for sending emails #117

@fabiodrg

Description

@fabiodrg

Motivation

No, I don't want to email myself 😄

image

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>
image

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions