export async function dangerouslySetPlaceholderPassword()

in src/server/lib/okta/dangerouslySetPlaceholderPassword.ts [36:62]


export async function dangerouslySetPlaceholderPassword({
	id,
	ip,
	returnPlaceholderPassword = false,
}: PlaceholderPasswordParams): Promise<string | void> {
	try {
		// Generate an recoveryToken OTT and put user into RECOVERY state
		const recoveryToken = await dangerouslyResetPassword(id, ip);

		const placeholderPassword =
			await dangerouslySetPlaceholderPasswordUsingRecoveryToken({
				id,
				ip,
				recoveryToken,
			});

		if (returnPlaceholderPassword) {
			return placeholderPassword;
		}
	} catch (error) {
		logger.error(
			`dangerouslySetPlaceholderPassword failed: Error setting placeholder password for user ${id}`,
			error,
		);
		throw error;
	}
}