feat: refine navigation and account access flow

This commit is contained in:
2026-08-14 14:16:04 +09:00
parent cee36bf12d
commit 146e78cddf
12 changed files with 239 additions and 124 deletions
+8 -4
View File
@@ -93,6 +93,13 @@ async function authPlugin(fastify, { config, googleClient } = {}) {
path: '/',
},
});
fastify.get('/auth/google/select-account', async (request, reply) => {
const authorizationUri = await fastify.googleOAuth2.generateAuthorizationUri(request, reply);
const url = new URL(authorizationUri);
url.searchParams.set('prompt', 'select_account');
return reply.redirect(url.href);
});
} else {
fastify.get('/auth/google', async () => {
throw new AppError('Google OAuth가 설정되지 않았습니다.', {
@@ -133,10 +140,7 @@ async function authPlugin(fastify, { config, googleClient } = {}) {
}
const allowedAccount = await fastify.allowedEmailRepository.findByEmail(payload.email);
if (!allowedAccount) {
throw new AppError('허용되지 않은 Google 계정입니다.', {
statusCode: 403,
code: 'GOOGLE_EMAIL_NOT_ALLOWED',
});
return reply.redirect('/login?error=account-not-allowed');
}
const user = await fastify.userRepository.upsertGoogleUser({