Files
webmail/lib/devices/types.ts
T
Linus Rath af6cdfb997 fix: keep unsent mail through the idle and session limits, and mark a signed-out account in the switcher
The timers used to delete everything an account kept, unsent mail included.
They now follow the refused-login rule: sign out and hide, the next sign-in
brings it back, otherwise it goes after 30 days. A login without "Remember
me" that ends with the browser, an admin wipe and a wipe from settings don't
change.

- `wipeOnRefusedLogin` is now `wipeOnForcedSignOut`, since it also covers the
  limits. The server's `SESSION_TOO_OLD` goes the same way, as `session`.
- A refused account beside one that stays signed in shows in the switcher as
  needing sign-in, with the count and the date, and gets one toast.

Existing tests changed because the rule did: the session timer tests expected
a plain `logoutAll`, and the auth store tests expected no hook at the session
limit.
2026-11-03 16:36:13 +01:00

35 lines
1.2 KiB
TypeScript

/**
* The device registry as both sides see it: what the instance lists for its
* admin and what a device says about its own wipe. No secrets, no store.
*/
/**
* Who asked for a wipe. `rejected`: the server refused the stored login, and
* `session`: the idle or session limit ran out, both where the organisation asks
* for deletion at once.
*/
export const WIPE_REASONS = ['admin', 'user', 'rejected', 'session'] as const;
export type WipeReason = (typeof WIPE_REASONS)[number];
export interface DeviceView {
/** `<settingsId(user, server)>/<deviceId>`. */
id: string;
/** The first part of `id`: every device of this user on this server. */
userKey: string;
user: string;
server: string;
platform: string;
appVersion: string;
firstSeen: string;
lastSeen: string;
/** Asked for and not confirmed yet. Stays until the device answers or the admin takes it back. */
wipe: { requestedAt: string; by: string } | null;
wipedAt: string | null;
wipeReason: WipeReason | null;
}
export const AUDIT_DEVICE_WIPE_REQUEST = 'device.wipe.request';
export const AUDIT_DEVICE_WIPE_CANCEL = 'device.wipe.cancel';
export const AUDIT_DEVICE_WIPE_CONFIRM = 'device.wipe.confirm';
export const AUDIT_DEVICE_FORGET = 'device.forget';