fitme3070.pt delegated all authentication to hub.andmore.pt: views/auth/*
were bounce stubs, and because this domain is outside the .andmore.pt cookie
scope the real handoff was a one-time HTTPS ticket redeem. Bring identity back
in-house — passwords live in users.password_hash, which the SSO migration
never dropped.
Removed: config/sso.php, IDENTITY_MODE, every SSO_* constant and env key,
identity_is_federated() and the cookie/ticket paths in the auth views and the
public-site bootstrap. ANDMORE_ID_URL stays — it is still the hub /notify
endpoint for outbound email/SMS, which the reset mails ride on, and has
nothing to do with authentication now.
Added, ported from the fotografia.andmore.pt sibling rather than invented:
- auth_login() with transparent password_needs_rehash upgrades and the
last_login trail; auth_register_client(); auth_set_password(); the
single-use 2h reset tokens.
- Real login / register / forgot_password / reset_password pages on a new
anonymous shell (includes/auth_header.php). includes/header.php renders
the backoffice sidebar and a logout button, which is wrong for a visitor
who is not signed in yet.
- safe_return_path(), so a crafted ?return_to= cannot bounce a freshly
authenticated user off-site.
- Per-IP throttling on login, register and reset-request. Successes count
too, so a guessed password cannot be parlayed into stuffing the rest of
the user list from the same IP.
- views/user/set_password.php: admin override for anyone whose email is
undeliverable. Prefers mailing an invite link so the backoffice never
handles the password. A plain admin cannot act on a sysadmin, and nobody
can use it on themselves — self-service goes through profile.php, which
demands the current password so a hijacked session cannot lock the owner
out.
Accounts provisioned during the SSO era have password_hash NULL. They get in
via the reset email, or by registering again with the same address:
auth_register_client() claims a passwordless row, but only a plain `client`
one, so knowing a staff address does not let anyone self-assign the role.
users.andmore_id is deliberately left in place. No code reads it any more, but
it records which central identity each row was linked to.
Deployment: apply database/migration_20260913_local_auth.sql (password_resets
+ auth_attempts) in the SAME sysadmin session that pulls this commit — the
forgot-password flow needs that table, and after the pull a login requires a
local password.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
68 lines
2.8 KiB
HTML
68 lines
2.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="pt">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>A sua conta</title>
|
|
</head>
|
|
<body style="margin:0;padding:0;background:#f4f4f4;font-family:Arial,Helvetica,sans-serif;">
|
|
<table width="100%" cellpadding="0" cellspacing="0" style="background:#f4f4f4;padding:30px 0;">
|
|
<tr>
|
|
<td align="center">
|
|
<table width="600" cellpadding="0" cellspacing="0" style="background:#ffffff;border-radius:8px;overflow:hidden;max-width:600px;width:100%;">
|
|
<!-- Header — dark background, so {{logo_html}} pulls the light logo -->
|
|
<tr>
|
|
<td style="background:#0a0a0a;padding:32px 40px;text-align:center;border-bottom:3px solid #C2D500;">
|
|
{{logo_html}}
|
|
</td>
|
|
</tr>
|
|
<!-- Body -->
|
|
<tr>
|
|
<td style="padding:40px 40px 32px;">
|
|
<p style="margin:0 0 16px;font-size:16px;color:#333333;">Olá {{user_name}},</p>
|
|
<p style="margin:0 0 24px;font-size:16px;color:#333333;">
|
|
Foi criada uma conta para si em {{app_name}}. Para começar a usá-la,
|
|
defina a sua palavra-passe através do botão abaixo.
|
|
</p>
|
|
<table cellpadding="0" cellspacing="0" style="margin:28px 0;">
|
|
<tr>
|
|
<td style="background:#C2D500;border-radius:4px;">
|
|
<a href="{{reset_url}}" style="display:inline-block;padding:14px 32px;color:#0a0a0a;text-decoration:none;font-size:15px;font-weight:bold;">
|
|
Definir palavra-passe
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<p style="margin:0 0 8px;font-size:14px;color:#888888;">
|
|
Ou copie este endereço para o seu browser:
|
|
</p>
|
|
<p style="margin:0 0 24px;font-size:13px;color:#555555;word-break:break-all;">
|
|
<a href="{{reset_url}}" style="color:#0a0a0a;">{{reset_url}}</a>
|
|
</p>
|
|
<p style="margin:0;font-size:13px;color:#999999;">
|
|
Este link é válido durante <strong>2 horas</strong> e só pode ser usado uma vez.
|
|
Se expirar, use a opção <strong>Esqueceu a palavra-passe?</strong> na página de entrada.
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<!-- Divider -->
|
|
<tr>
|
|
<td style="padding:0 40px;">
|
|
<hr style="border:none;border-top:1px solid #eeeeee;margin:0;">
|
|
</td>
|
|
</tr>
|
|
<!-- Footer -->
|
|
<tr>
|
|
<td style="padding:24px 40px;text-align:center;">
|
|
<p style="margin:0;font-size:13px;color:#999999;">
|
|
{{app_name}}
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</body>
|
|
</html>
|