From b8063e86921f2dec9c326150771f65e0fbdfbc18 Mon Sep 17 00:00:00 2001 From: Ahmed Al-Taiar Date: Wed, 9 Oct 2024 20:44:12 -0400 Subject: [PATCH] Auth tweaks --- api/src/functions/auth.ts | 4 +- api/src/lib/email.ts | 5 +-- .../pages/FatalErrorPage/FatalErrorPage.tsx | 41 +------------------ .../ForgotPasswordPage/ForgotPasswordPage.tsx | 4 +- web/src/pages/LoginPage/LoginPage.tsx | 4 +- .../ResetPasswordPage/ResetPasswordPage.tsx | 2 +- 6 files changed, 11 insertions(+), 49 deletions(-) diff --git a/api/src/functions/auth.ts b/api/src/functions/auth.ts index 2f4f021..d740851 100644 --- a/api/src/functions/auth.ts +++ b/api/src/functions/auth.ts @@ -111,9 +111,7 @@ ${domain}/reset-password?resetToken=${resetToken} // the database. Returning anything truthy will automatically log the user // in. Return `false` otherwise, and in the Reset Password page redirect the // user to the login page. - handler: (_user) => { - return true - }, + handler: (_user) => false, // If `false` then the new password MUST be different from the current one allowReusedPassword: true, diff --git a/api/src/lib/email.ts b/api/src/lib/email.ts index c40981f..2a28b77 100644 --- a/api/src/lib/email.ts +++ b/api/src/lib/email.ts @@ -15,15 +15,14 @@ const transporter = nodemailer.createTransport({ }, }) -export const sendEmail = async ({ to, subject, text, html }: Options) => { - return await transporter.sendMail({ +export const sendEmail = async ({ to, subject, text, html }: Options) => + await transporter.sendMail({ from: `"${process.env.FIRST_NAME} ${process.env.LAST_NAME} (noreply)" <${process.env.GMAIL}>`, to: Array.isArray(to) ? to : [to], subject, text, html, }) -} export const censorEmail = (email: string): string => { const [localPart, domain] = email.split('@') diff --git a/web/src/pages/FatalErrorPage/FatalErrorPage.tsx b/web/src/pages/FatalErrorPage/FatalErrorPage.tsx index b2bb436..22aba35 100644 --- a/web/src/pages/FatalErrorPage/FatalErrorPage.tsx +++ b/web/src/pages/FatalErrorPage/FatalErrorPage.tsx @@ -13,45 +13,6 @@ import { DevFatalErrorPage } from '@redwoodjs/web/dist/components/DevFatalErrorP export default DevFatalErrorPage || (() => (
-