v3: added password change/reset feature
This commit is contained in:
@@ -380,6 +380,27 @@ export function notificationRowToApi(row: NotificationRow): Notification {
|
||||
};
|
||||
}
|
||||
|
||||
// ── Password reset tokens ─────────────────────────────────────────────────────
|
||||
|
||||
export interface PasswordResetTokenRow {
|
||||
token: string;
|
||||
user_id: string;
|
||||
expires_at: string;
|
||||
used_at: string | null;
|
||||
[key: string]: SQLOutputValue;
|
||||
}
|
||||
|
||||
export function isPasswordResetTokenRow(
|
||||
obj: unknown,
|
||||
): obj is PasswordResetTokenRow {
|
||||
return !!obj && typeof obj === "object" &&
|
||||
"token" in obj && typeof obj.token === "string" &&
|
||||
"user_id" in obj && typeof obj.user_id === "string" &&
|
||||
"expires_at" in obj && typeof obj.expires_at === "string" &&
|
||||
"used_at" in obj &&
|
||||
(obj.used_at === null || typeof obj.used_at === "string");
|
||||
}
|
||||
|
||||
// ── Invites ───────────────────────────────────────────────────────────────────
|
||||
|
||||
export interface InviteRow {
|
||||
|
||||
@@ -177,6 +177,22 @@ export function isInvitePayload(obj: unknown): obj is InvitePayload {
|
||||
typeof (obj as Record<string, unknown>).inviterId === "string";
|
||||
}
|
||||
|
||||
export interface PasswordResetPayload {
|
||||
purpose: "password-reset";
|
||||
userId: string;
|
||||
exp: number;
|
||||
}
|
||||
|
||||
export function isPasswordResetPayload(
|
||||
obj: unknown,
|
||||
): obj is PasswordResetPayload {
|
||||
return !!obj && typeof obj === "object" &&
|
||||
"purpose" in obj &&
|
||||
(obj as Record<string, unknown>).purpose === "password-reset" &&
|
||||
"userId" in obj &&
|
||||
typeof (obj as Record<string, unknown>).userId === "string";
|
||||
}
|
||||
|
||||
/**
|
||||
* API
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user