mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-19 13:21:46 +00:00
Fix a batch of reported bugs (#1145)
* fix(maps): fall back to OSM/Wikipedia for place photos and normalize non-standard language codes (#1137) * fix(auth): refuse password reset for OIDC/SSO-linked accounts (#1129) * fix(docker): ship server/assets (airports + atlas geo) in the runtime image (#1133, #1119) * fix(unraid): point the template at a PNG icon Unraid can render (#1073) * fix(offline): serve cached file blobs when offline or on network failure (#1046, #1069) * fix(map): centre the selected pin in the visible map area above the bottom panel (#1125) * fix(pdf): render persisted place-photo proxy URLs as images (#1130) * fix(planner): show the selected place category in the edit form (#1134) * fix(dashboard): collapse list-view trip cards to a compact row on mobile (#1132)
This commit is contained in:
@@ -85,6 +85,7 @@ import {
|
||||
validateInviteToken,
|
||||
registerUser,
|
||||
loginUser,
|
||||
requestPasswordReset,
|
||||
changePassword,
|
||||
verifyMfaLogin,
|
||||
createMcpToken,
|
||||
@@ -106,6 +107,35 @@ beforeEach(() => resetTestDb(testDb));
|
||||
|
||||
afterAll(() => testDb.close());
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// requestPasswordReset — OIDC/SSO accounts (#1129)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
describe('requestPasswordReset — OIDC/SSO accounts', () => {
|
||||
it('AUTH-DB-PR1: refuses a reset for an OIDC-linked account that has a (random) password hash', () => {
|
||||
const { user } = createUser(testDb);
|
||||
// OIDC users are created with a random bcrypt hash, so password_hash is set —
|
||||
// the old guard keyed off a missing hash and therefore let the reset through.
|
||||
testDb.prepare('UPDATE users SET oidc_sub = ?, oidc_issuer = ? WHERE id = ?')
|
||||
.run('sub-1129', 'https://idp.example', user.id);
|
||||
|
||||
const result = requestPasswordReset(user.email, null);
|
||||
|
||||
expect(result.reason).toBe('oidc_only');
|
||||
expect(result.tokenForDelivery).toBeNull();
|
||||
const { n } = testDb.prepare('SELECT COUNT(*) AS n FROM password_reset_tokens WHERE user_id = ?')
|
||||
.get(user.id) as { n: number };
|
||||
expect(n).toBe(0);
|
||||
});
|
||||
|
||||
it('AUTH-DB-PR2: still issues a reset for a normal local (non-SSO) account', () => {
|
||||
const { user } = createUser(testDb);
|
||||
const result = requestPasswordReset(user.email, null);
|
||||
expect(result.reason).toBe('issued');
|
||||
expect(result.tokenForDelivery).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// updateSettings
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user