fix: add public profiles tests

This commit is contained in:
David Nguyen
2025-02-19 16:07:04 +11:00
parent 5ce2bae39d
commit a319ea0f5e
26 changed files with 187 additions and 41 deletions

View File

@ -30,10 +30,10 @@ const getAuthSecret = () => {
export const sessionCookieOptions = {
httpOnly: true,
path: '/',
sameSite: useSecureCookies ? 'none' : 'lax', // Todo: This feels wrong?
sameSite: useSecureCookies ? 'none' : 'lax', // Todo: (RR7) This feels wrong?
secure: useSecureCookies,
domain: getCookieDomain(),
// Todo: Max age for specific auth cookies.
// Todo: (RR7) Max age for specific auth cookies.
} as const;
export const extractSessionCookieFromHeaders = (headers: Headers): string | null => {

View File

@ -38,7 +38,7 @@ export const getOptionalSession = async (
};
/**
* Todo: Rethink, this is pretty sketchy.
* Todo: (RR7) Rethink, this is pretty sketchy.
*/
const mapRequestToContextForCookie = (c: Context | Request) => {
if (c instanceof Request) {

View File

@ -144,7 +144,7 @@ export const handleOAuthCallbackUrl = async (options: HandleOAuthCallbackUrlOpti
},
data: {
emailVerified: new Date(),
password: null, // Todo: Check this
password: null, // Todo: (RR7) Check this
},
});
}
@ -182,7 +182,7 @@ export const handleOAuthCallbackUrl = async (options: HandleOAuthCallbackUrlOpti
});
await onCreateUserHook(createdUser).catch((err) => {
// Todo: Add logging.
// Todo: (RR7) Add logging.
console.error(err);
});

View File

@ -50,7 +50,7 @@ export const emailPasswordRoute = new Hono<HonoAuthContext>()
const csrfCookieToken = await getCsrfCookie(c);
// Todo: Add logging here.
// Todo: (RR7) Add logging here.
if (csrfToken !== csrfCookieToken || !csrfCookieToken) {
throw new AppError(AuthenticationErrorCode.InvalidRequest, {
message: 'Invalid CSRF token',