-
Notifications
You must be signed in to change notification settings - Fork 0
회원 탈퇴 기능 구현 #576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
goder-0
wants to merge
2
commits into
main
Choose a base branch
from
feature/#565-member-withdrawal
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
회원 탈퇴 기능 구현 #576
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import SVGIcon from '@/components/Icons/SVGIcon'; | ||
| import Button from '@/components/basics/Button/Button'; | ||
| import Link from 'next/link'; | ||
|
|
||
| export default function AccountDeletedPage() { | ||
| return ( | ||
| <main className="bg-gray50 relative flex min-h-screen items-center justify-center overflow-hidden px-4 py-12"> | ||
| <div | ||
| className="absolute inset-x-0 bottom-0 h-[34%] bg-[url('/images/account-deleted-background.webp')] bg-cover bg-center" | ||
| aria-hidden="true" | ||
| /> | ||
| <section className="border-gray100 relative z-10 flex w-full max-w-[520px] flex-col items-center rounded-2xl border bg-white px-8 py-11 text-center"> | ||
| <SVGIcon icon="IC_Complete" size="2xl" className="text-blue400" aria-hidden="true" /> | ||
| <h1 className="font-title-md text-gray900 mt-6">회원 탈퇴가 완료되었습니다.</h1> | ||
| <p className="font-body-md text-gray600 mt-4"> | ||
| 그동안 링카이빙을 이용해 주셔서 진심으로 감사드립니다. | ||
| <br /> | ||
| 앞으로 더 좋은 모습으로 만나뵐 수 있기를 바랍니다. | ||
| </p> | ||
| <Button asChild label="링카이빙 홈으로 이동하기" className="mt-10 w-full"> | ||
| <Link href="/">링카이빙 홈으로 이동하기</Link> | ||
| </Button> | ||
| </section> | ||
| </main> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import { handleApiError } from '@/hooks/util/api'; | ||
| import { COOKIES_KEYS } from '@/lib/constants/cookies'; | ||
| import { serverApiClient } from '@/lib/server/apiClient'; | ||
| import { NextResponse } from 'next/server'; | ||
|
|
||
| const DELETE_REASONS = new Set([ | ||
| 'NO_USEFUL_LINKS', | ||
| 'POOR_SEARCH', | ||
| 'NO_REVISIT', | ||
| 'SWITCHED_SERVICE', | ||
| 'PRIVACY_CONCERN', | ||
| 'OTHER', | ||
| ]); | ||
|
|
||
| const isCrossSiteRequest = (request: Request) => { | ||
| if (request.headers.get('sec-fetch-site') === 'cross-site') return true; | ||
|
|
||
| const origin = request.headers.get('origin'); | ||
| return origin ? origin !== new URL(request.url).origin : false; | ||
| }; | ||
|
|
||
| export async function DELETE(request: Request) { | ||
| if (isCrossSiteRequest(request)) { | ||
| return NextResponse.json({ success: false, message: 'Forbidden' }, { status: 403 }); | ||
| } | ||
|
|
||
| try { | ||
| const body = await request.json().catch(() => null); | ||
| if ( | ||
| !body || | ||
| body.confirmed !== true || | ||
| !DELETE_REASONS.has(body.deleteReason) || | ||
| typeof body.clientId !== 'string' || | ||
| !/^\d+\.\d+$/.test(body.clientId) | ||
| ) { | ||
| return NextResponse.json({ success: false, message: 'Invalid request' }, { status: 400 }); | ||
| } | ||
|
|
||
| await serverApiClient('/v1/member', { | ||
| method: 'DELETE', | ||
| body: JSON.stringify({ | ||
| confirmed: true, | ||
| deleteReason: body.deleteReason, | ||
| clientId: body.clientId, | ||
| }), | ||
| }); | ||
|
|
||
| const response = NextResponse.json({ success: true }); | ||
| const cookieOptions = { | ||
| path: '/', | ||
| ...(process.env.COOKIE_DOMAIN ? { domain: process.env.COOKIE_DOMAIN } : {}), | ||
| expires: new Date(0), | ||
| sameSite: 'lax' as const, | ||
| }; | ||
|
|
||
| response.cookies.set(COOKIES_KEYS.ACCESS_TOKEN, '', cookieOptions); | ||
| response.cookies.set(COOKIES_KEYS.REFRESH_TOKEN, '', cookieOptions); | ||
| response.cookies.set(COOKIES_KEYS.USER_INFO, '', cookieOptions); | ||
| response.cookies.set(COOKIES_KEYS.ACCOUNT_DELETED, 'true', { | ||
| path: '/', | ||
| httpOnly: true, | ||
| sameSite: 'lax', | ||
| secure: process.env.NODE_ENV === 'production', | ||
| maxAge: 60, | ||
| }); | ||
|
|
||
| return response; | ||
| } catch (error) { | ||
| return handleApiError(error); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.