Files
formbricks/apps/web/modules/auth/actions/sign-out.ts
T
Kunal Garg 979fd71a11 feat: reset password in accounts page (#5219)
Co-authored-by: Piyush Gupta <piyushguptaa2z123@gmail.com>
Co-authored-by: Johannes <johannes@formbricks.com>
2025-07-01 15:41:14 +00:00

39 lines
949 B
TypeScript

"use server";
import { logSignOut } from "@/modules/auth/lib/utils";
import { logger } from "@formbricks/logger";
/**
* Logs a sign out event
* @param userId - The ID of the user who signed out
* @param userEmail - The email of the user who signed out
* @param context - The context of the sign out event
*/
export const logSignOutAction = async (
userId: string,
userEmail: string,
context: {
reason?:
| "user_initiated"
| "account_deletion"
| "email_change"
| "session_timeout"
| "forced_logout"
| "password_reset";
redirectUrl?: string;
organizationId?: string;
}
) => {
try {
logSignOut(userId, userEmail, context);
} catch (error) {
logger.error("Failed to log sign out event", {
userId,
context,
error: error instanceof Error ? error.message : String(error),
});
// Re-throw to ensure callers are aware of the failure
throw error;
}
};