Skip to content

Commit 5408ca5

Browse files
Run password delay at action start
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
1 parent bdf93fc commit 5408ca5

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

app/routes/login.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export const meta: MetaFunction<typeof loader, { root: RootLoaderType }> = ({
8484
}
8585

8686
export async function action({ request }: Route.ActionArgs) {
87+
await applyPasswordSubmissionDelay()
8788
const formData = await request.formData()
8889
const loginSession = await getLoginInfoSession(request)
8990

@@ -106,7 +107,6 @@ export async function action({ request }: Route.ActionArgs) {
106107
}
107108

108109
if (email) loginSession.setEmail(email)
109-
await applyPasswordSubmissionDelay()
110110

111111
if (!email.match(/.+@.+/)) {
112112
loginSession.flashError('A valid email is required')

app/routes/me_.password.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ export async function loader({ request }: Route.LoaderArgs) {
3737
}
3838

3939
export async function action({ request }: Route.ActionArgs) {
40+
await applyPasswordSubmissionDelay()
4041
const user = await requireUser(request)
4142
const formData = await request.formData()
42-
await applyPasswordSubmissionDelay()
4343

4444
const currentPassword = formData.get('currentPassword')
4545
const password = typeof formData.get('password') === 'string' ? String(formData.get('password')) : ''

app/routes/reset-password.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export async function loader({ request }: Route.LoaderArgs) {
101101
}
102102

103103
export async function action({ request }: Route.ActionArgs) {
104+
await applyPasswordSubmissionDelay()
104105
const loginSession = await getLoginInfoSession(request)
105106
const formData = await request.formData()
106107
const actionId = formData.get('actionId')
@@ -198,8 +199,6 @@ export async function action({ request }: Route.ActionArgs) {
198199
return redirect('/reset-password', { headers: await loginSession.getHeaders() })
199200
}
200201

201-
await applyPasswordSubmissionDelay()
202-
203202
const passwordEntry = formData.get('password')
204203
const password = typeof passwordEntry === 'string' ? passwordEntry : ''
205204
const confirmPassword =

app/routes/signup.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ const actionIds = {
8080
}
8181

8282
export async function action({ request }: Route.ActionArgs) {
83+
await applyPasswordSubmissionDelay()
8384
const loginInfoSession = await getLoginInfoSession(request)
8485

8586
const requestText = await request.text()
@@ -216,8 +217,6 @@ export async function action({ request }: Route.ActionArgs) {
216217
const password = form.get('password')
217218
const confirmPassword = form.get('confirmPassword')
218219

219-
await applyPasswordSubmissionDelay()
220-
221220
const errors: ActionData['errors'] = {
222221
firstName: getErrorForFirstName(typeof firstName === 'string' ? firstName : null),
223222
team: getErrorForTeam(typeof team === 'string' ? team : null),

0 commit comments

Comments
 (0)