Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/app/api/auth/callback/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createClient } from '@/lib/clients/supabase/server'
import { redirect } from 'next/navigation'
import { AUTH_URLS, PROTECTED_URLS } from '@/configs/urls'
import { logError, logInfo } from '@/lib/clients/logger'
import { PROTECTED_URLS } from '@/configs/urls'
import { logInfo } from '@/lib/clients/logger'
import { ERROR_CODES } from '@/configs/logs'

export async function GET(request: Request) {
Expand All @@ -26,7 +26,7 @@ export async function GET(request: Request) {
const { data, error } = await supabase.auth.exchangeCodeForSession(code)

if (error) {
logError(
console.error(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change from logError > console.error?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the logger is nice when the args do not include a class instance (error in this case). i am about to fix this but in another pr.

ERROR_CODES.SUPABASE,
'Error exchanging code for session:',
error
Expand Down
8 changes: 8 additions & 0 deletions src/server/auth/auth-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
shouldWarnAboutAlternateEmail,
validateEmail,
} from '@/server/auth/validate-email'
import { ERROR_CODES } from '@/configs/logs'

export const signInWithOAuthAction = actionClient
.schema(
Expand Down Expand Up @@ -171,6 +172,13 @@ export const forgotPasswordAction = actionClient
})

if (error) {
console.error(ERROR_CODES.SUPABASE, 'Error resetting password:', error)
if (error.message.includes('security purposes')) {
return returnServerError(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need to return here? returnServerError throws

Copy link
Copy Markdown
Member Author

@ben-fornefeld ben-fornefeld Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, it's just a convenient wrapper i am using because next-safe-action also has returnValidationError().
returnServerError actually also just throws under the hood since this is the way the actionClient is configured

'Please wait before requesting another password reset'
)
}

throw error
}
})
Expand Down