Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
de6d9d3
feat(common): add Button, Toast, Header, BottomNavigation components
evenif99 Jun 16, 2026
94d7a31
docs: update collaboration policy
evenif99 Jun 16, 2026
04d0afc
Merge branch 'dev' into feature/common-component-jw
evenif99 Jun 16, 2026
1c67829
feat(common): add Tabs, CaseCard, ActionPrompt, Input, Select, Textar…
evenif99 Jun 16, 2026
98c9d9b
feat(common): apply MUI icons and Snackbar, update MUI usage policy
evenif99 Jun 16, 2026
bf17eb8
docs: update icon policy — @mui/icons-material except diary feature
evenif99 Jun 17, 2026
424bf36
fix(common): ActionPrompt message 제거 및 Textarea 글자수 카운터 absolute 배치
evenif99 Jun 17, 2026
d776042
chore: dev 최신사항 병합 및 충돌 해소
evenif99 Jun 17, 2026
396f434
Merge remote-tracking branch 'origin/dev' into feature/common-compone…
evenif99 Jun 17, 2026
d2a9063
Merge remote-tracking branch 'origin/dev' into feature/common-compone…
evenif99 Jun 17, 2026
3220799
Merge remote-tracking branch 'origin/dev' into feature/common-compone…
evenif99 Jun 17, 2026
58e961a
Merge remote-tracking branch 'origin/dev' into feature/common-compone…
evenif99 Jun 17, 2026
3e294fc
Merge branch 'dev' into feature/common-component-jw
evenif99 Jun 17, 2026
0a8143e
Merge branch 'dev' of https://github.com/I5-Project/TALKY-OWL into fe…
evenif99 Jun 17, 2026
1cf38c6
Merge remote-tracking branch 'origin/dev' into feature/common-compone…
evenif99 Jun 18, 2026
29b612f
feat: 카카오 로그인 기능 구현
evenif99 Jun 18, 2026
e7e482e
Merge remote-tracking branch 'origin/dev' into feature/common-compone…
evenif99 Jun 18, 2026
1f30c28
fix: 로그인 페이지 및 인증 로직 개선
evenif99 Jun 18, 2026
8c70a4b
fix: disclaimer mixin 적용, nickname 유실 복구 및 fallback 랜덤화
evenif99 Jun 18, 2026
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
79 changes: 79 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"prisma:migrate": "prisma migrate dev"
},
"dependencies": {
"@auth/prisma-adapter": "^2.11.2",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@google/generative-ai": "^0.21.0",
Expand Down
2 changes: 1 addition & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ model User {

// TALKY-OWL 서비스 필드
kakaoId String? @unique @map("kakao_id") @db.VarChar(100)
nickname String? @db.VarChar(100)
nickname String? @unique @db.VarChar(100)
profileImageUrl String? @map("profile_image_url")
profileMediaAssetId String? @map("profile_media_asset_id") @db.Uuid
gender UserGender?
Expand Down
Binary file added public/images/common/login_character.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions src/app/(page)/login/login.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
@use '@/styles/abstracts/variables' as v;
@use '@/styles/abstracts/functions' as fn;

.page {
display: flex;
flex-direction: column;
min-height: 100svh;
padding: fn.r(20) fn.r(24) fn.r(40);
}

.content {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
}

.logo {
display: flex;
flex-direction: column;
align-items: center;
gap: fn.r(20);
}

.character {
width: 40vw;
max-width: fn.r(200);
height: auto;
image-rendering: pixelated;
}

.logoImage {
width: 45vw;
height: auto;
max-width: fn.r(200);
}

.footer {
display: flex;
flex-direction: column;
gap: fn.r(12);
}

.kakaoButton {
background-color: #fee500 !important;
color: #000000 !important;
gap: fn.r(8);

&:hover:not(:disabled) {
background-color: #f5dc00 !important;
}
}

.disclaimer {
font-size: v.$font-size-caption;
font-weight: v.$font-weight-regular;
color: v.$color-black-400;
text-align: center;
line-height: v.$line-height-caption;

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.

mixin 사용 부탁드립니다

}

.disclaimerLink {
text-decoration: underline;
cursor: pointer;
color: inherit;
}
73 changes: 73 additions & 0 deletions src/app/(page)/login/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
'use client';

import Image from 'next/image';
import Link from 'next/link';
import { signIn } from 'next-auth/react';
import Button from '@/components/ui/Button';
import styles from './login.module.scss';

export default function LoginPage() {
return (
<div className={styles.page}>
<div className={styles.content}>
<div className={styles.logo}>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
src="/images/common/login_character.png"
alt="말해부엉 캐릭터"
className={styles.character}
/>
<Image

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

이걸 이미지 처리했네요....?!?! 충분히 코드로 처리 가능할 것 같은뎁...

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.

해당 폰트를 쓰는곳이 로고밖에 없기때문에 이미지가 맞을거같아서 제가 미리 만들어둔거에요!
웹폰트로 처리하는게 더비용이 크지않을까요?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

아 비용이 들어가는 폰트라면 그게 나을 것 같네요.

src="/images/common/logo.png"
alt="말해부엉"
width={264}
height={76}
sizes="(max-width: 667px) 45vw, 200px"
className={styles.logoImage}
/>
</div>
</div>

<div className={styles.footer}>
<Button
className={styles.kakaoButton}
onClick={() => signIn('kakao', { callbackUrl: '/home' })}
>
<KakaoIcon />
카카오로 로그인 하기
</Button>
<p className={styles.disclaimer}>
로그인 시{' '}
<Link href="/terms" className={styles.disclaimerLink}>
이용약관
</Link>{' '}
및{' '}
<Link href="/privacy" className={styles.disclaimerLink}>
개인정보 처리방침
</Link>
에 동의한 것으로 간주합니다.
</p>
</div>
</div>
);
}

function KakaoIcon() {
return (
<svg
width="18"
height="18"
viewBox="0 0 18 18"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M9 1.5C4.858 1.5 1.5 4.134 1.5 7.38c0 2.1 1.395 3.942 3.498 4.998L4.1 15.228a.188.188 0 0 0 .288.204l3.726-2.472A8.8 8.8 0 0 0 9 13.26c4.142 0 7.5-2.634 7.5-5.88S13.142 1.5 9 1.5Z"
fill="#000000"
/>
</svg>
Comment on lines +57 to +71

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.

아이콘이 깨져보이는데 확인부탁드려요

);
}
49 changes: 49 additions & 0 deletions src/lib/auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,63 @@
import type { NextAuthOptions } from 'next-auth'
import KakaoProvider from 'next-auth/providers/kakao'
import { PrismaAdapter } from '@auth/prisma-adapter'
import { prisma } from '@/lib/db'
import { generateNickname } from './nickname'

const MAX_NICKNAME_RETRIES = 10

async function saveFirstLoginFields(userId: string, kakaoId: string): Promise<void> {
for (let attempt = 0; attempt < MAX_NICKNAME_RETRIES; attempt++) {
const isLastAttempt = attempt === MAX_NICKNAME_RETRIES - 1
const nickname = isLastAttempt
? `부엉이${Date.now()}`
: generateNickname()

try {
await prisma.user.update({
where: { id: userId },
data: { kakaoId, nickname, termsAgreedAt: new Date() },
})
return
} catch (e) {
const err = e as { code?: string; meta?: { target?: string[] } }
if (err.code === 'P2002' && err.meta?.target?.includes('nickname')) {
continue
}
throw e
}
}
}
Comment on lines +9 to +30

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

모든 재시도 실패 시 오류가 발생하지 않습니다.

루프가 10회 모두 P2002 오류로 실패하면 함수가 정상 종료되어 signIn 콜백이 true를 반환합니다. 이 경우 사용자는 로그인되지만 kakaoId, nickname, termsAgreedAt 필드가 설정되지 않은 채로 남습니다.

🐛 재시도 실패 시 오류를 던지도록 수정
       throw e
     }
   }
+  throw new Error('고유 닉네임 생성 실패: 재시도 한도 초과')
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async function saveFirstLoginFields(userId: string, kakaoId: string): Promise<void> {
for (let attempt = 0; attempt < MAX_NICKNAME_RETRIES; attempt++) {
const isLastAttempt = attempt === MAX_NICKNAME_RETRIES - 1
const nickname = isLastAttempt
? `부엉이${Date.now()}`
: generateNickname()
try {
await prisma.user.update({
where: { id: userId },
data: { kakaoId, nickname, termsAgreedAt: new Date() },
})
return
} catch (e) {
const err = e as { code?: string; meta?: { target?: string[] } }
if (err.code === 'P2002' && err.meta?.target?.includes('nickname')) {
continue
}
throw e
}
}
}
async function saveFirstLoginFields(userId: string, kakaoId: string): Promise<void> {
for (let attempt = 0; attempt < MAX_NICKNAME_RETRIES; attempt++) {
const isLastAttempt = attempt === MAX_NICKNAME_RETRIES - 1
const nickname = isLastAttempt
? `부엉이${Date.now()}`
: generateNickname()
try {
await prisma.user.update({
where: { id: userId },
data: { kakaoId, nickname, termsAgreedAt: new Date() },
})
return
} catch (e) {
const err = e as { code?: string; meta?: { target?: string[] } }
if (err.code === 'P2002' && err.meta?.target?.includes('nickname')) {
continue
}
throw e
}
}
throw new Error('고유 닉네임 생성 실패: 재시도 한도 초과')
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/auth/index.ts` around lines 9 - 30, The saveFirstLoginFields function
lacks error handling when all retry attempts are exhausted. After the for loop
completes without returning early (meaning all MAX_NICKNAME_RETRIES attempts
failed with P2002 errors), the function implicitly returns undefined instead of
throwing an error, causing silent failures where the user is created with
incomplete data. Add a throw statement after the for loop in
saveFirstLoginFields to raise an error when all nickname generation attempts
fail, ensuring the signIn callback properly detects and rejects failed user
creation operations.


export const authOptions: NextAuthOptions = {
adapter: PrismaAdapter(prisma) as NextAuthOptions['adapter'],
session: { strategy: 'jwt' },
providers: [
KakaoProvider({
clientId: process.env.KAKAO_CLIENT_ID!,
clientSecret: process.env.KAKAO_CLIENT_SECRET!,
}),
],
pages: {
signIn: '/login',
error: '/login',
},
callbacks: {
async signIn({ user, account }) {
if (account?.provider === 'kakao' && user.id) {
const existing = await prisma.user.findUnique({
where: { id: user.id },
select: { kakaoId: true },
})

// kakaoId가 없으면 최초 로그인 → 커스텀 필드 설정 (닉네임 충돌 시 재시도)
if (!existing?.kakaoId) {
await saveFirstLoginFields(user.id, account.providerAccountId)
}
}

return true
},
jwt({ token, user }) {
if (user) {
token.sub = user.id
Expand Down
12 changes: 12 additions & 0 deletions src/lib/auth/nickname.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const VERBS = [
'날아다니는', '잠자는', '노래하는', '춤추는', '달리는',
'웃는', '생각하는', '먹는', '빛나는', '졸고있는',
'반짝이는', '행복한', '신나는', '귀여운', '멋진',
'느긋한', '용감한', '씩씩한', '지혜로운', '엉뚱한',
]

export function generateNickname(): string {
const verb = VERBS[Math.floor(Math.random() * VERBS.length)]
const digits = String(Math.floor(Math.random() * 9000) + 1000)
return `${verb}부엉이${digits}`
}
7 changes: 7 additions & 0 deletions src/middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export { default } from 'next-auth/middleware'

export const config = {
matcher: [
'/((?!login(?:/|$)|api/auth(?:/|$)|_next/static|_next/image|favicon\\.ico$|images(?:/|$)).*)',
],
}