Compare commits
9 Commits
cb309cf0fa
...
v0.1.43
| Author | SHA1 | Date | |
|---|---|---|---|
| a38714dfe4 | |||
| 54f4b34e5e | |||
| d59795b089 | |||
| 8a46c507e9 | |||
| a78ad7e8fb | |||
| 477d453888 | |||
| 75abcd7333 | |||
| 803ecb34ad | |||
| c1c7288127 |
@@ -6,3 +6,8 @@ ADMIN_ACCOUNT_ID=replace-with-private-admin-id
|
|||||||
ADMIN_ACCOUNT_PASSWORD=replace-with-private-admin-password
|
ADMIN_ACCOUNT_PASSWORD=replace-with-private-admin-password
|
||||||
ADMIN_ACCOUNT_EMAIL=admin@example.com
|
ADMIN_ACCOUNT_EMAIL=admin@example.com
|
||||||
ADMIN_ACCOUNT_NICKNAME=Planner Admin
|
ADMIN_ACCOUNT_NICKNAME=Planner Admin
|
||||||
|
APP_BASE_URL=https://planner.sori.studio
|
||||||
|
RESEND_API_KEY=replace-with-private-resend-api-key
|
||||||
|
MAIL_FROM_EMAIL=planner@sori.studio
|
||||||
|
MAIL_FROM_NAME=10 Minute Planner
|
||||||
|
AUTH_PREVIEW_LINKS=false
|
||||||
|
|||||||
11
HANDOFF.md
11
HANDOFF.md
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
- 프로젝트명: 10 Minute Planner 웹 UI
|
- 프로젝트명: 10 Minute Planner 웹 UI
|
||||||
- 기술 스택: Vue 3 + Vite + TailwindCSS + JavaScript
|
- 기술 스택: Vue 3 + Vite + TailwindCSS + JavaScript
|
||||||
- 현재 기준 버전: `v0.1.42` 준비 중
|
- 현재 기준 버전: `v0.1.43` 준비 중
|
||||||
- Git 원격 저장소: `https://git.sori.studio/zenn/planner.sori.studio.git`
|
- Git 원격 저장소: `https://git.sori.studio/zenn/planner.sori.studio.git`
|
||||||
|
|
||||||
## 기준 디자인
|
## 기준 디자인
|
||||||
@@ -219,6 +219,15 @@
|
|||||||
- 플래너 본문 시간 라벨은 `총 시간`에서 `FOCUSED TIME`으로 바꿨다. 인쇄 CSS에서 COMMENT/FOCUSED TIME 라벨이 잘리지 않도록 부모 overflow를 열고, COMMENT는 남는 폭을 채우며 FOCUSED TIME은 오른쪽 210px 칸에 붙도록 조정했다.
|
- 플래너 본문 시간 라벨은 `총 시간`에서 `FOCUSED TIME`으로 바꿨다. 인쇄 CSS에서 COMMENT/FOCUSED TIME 라벨이 잘리지 않도록 부모 overflow를 열고, COMMENT는 남는 폭을 채우며 FOCUSED TIME은 오른쪽 210px 칸에 붙도록 조정했다.
|
||||||
- Docker 배포용 루트 `.env`와 개발용 `.env.dev`를 분리했다. `docker-compose.yml`은 운영 `.env`, `docker-compose.dev.yml`은 기존 dev Postgres 볼륨과 맞는 `.env.dev`를 읽는다.
|
- Docker 배포용 루트 `.env`와 개발용 `.env.dev`를 분리했다. `docker-compose.yml`은 운영 `.env`, `docker-compose.dev.yml`은 기존 dev Postgres 볼륨과 맞는 `.env.dev`를 읽는다.
|
||||||
- STATS의 `RANGE FLOW`는 항목 수에 따라 막대 폭과 간격을 조정한다. 1주일 내외는 넓은 막대로 카드 폭을 채우고, 1달 내외는 좁은 막대와 요약 라벨로 한 화면에서 흐름을 보며, 세부 날짜와 집중 시간은 막대 hover 팝업으로 확인한다.
|
- STATS의 `RANGE FLOW`는 항목 수에 따라 막대 폭과 간격을 조정한다. 1주일 내외는 넓은 막대로 카드 폭을 채우고, 1달 내외는 좁은 막대와 요약 라벨로 한 화면에서 흐름을 보며, 세부 날짜와 집중 시간은 막대 hover 팝업으로 확인한다.
|
||||||
|
- 왼쪽 사이드바의 인쇄 영역은 `PRINT` 버튼 하나로 줄이고, 클릭 시 모달에서 시작일/종료일과 `1페이지씩` 또는 `2페이지씩` 출력 방식을 선택한다. 인쇄 전용 렌더링은 선택 기간의 날짜를 순서대로 여러 장 생성하며, 2페이지씩 출력에서 홀수 날짜가 남으면 오른쪽은 빈 페이지 프레임으로 둔다.
|
||||||
|
- 회원가입과 프로필 수정 시 이메일뿐 아니라 닉네임 중복도 서버에서 409로 막는다. 비밀번호 재설정 API는 로그인 모달의 `비밀번호 찾기` 흐름과 연결되어 있고, `/reset-password?token=...` URL로 들어오면 새 비밀번호 설정 모드가 열린다. 실제 메일 발송 전까지는 백엔드 응답의 `resetPreviewUrl`을 개발용 링크로 표시한다.
|
||||||
|
- Resend 메일러가 추가되었다. `RESEND_API_KEY`, `MAIL_FROM_EMAIL`, `MAIL_FROM_NAME`, `APP_BASE_URL` 환경변수를 설정하면 이메일 인증과 비밀번호 재설정 메일을 실제로 발송한다. API 키는 저장소에 커밋하지 말고 루트 `.env`/`.env.dev`에만 넣는다.
|
||||||
|
- 인증/비밀번호 재설정 개발용 링크는 `AUTH_PREVIEW_LINKS=true`일 때만 API 응답에 포함된다. 운영 `.env`는 반드시 `AUTH_PREVIEW_LINKS=false`로 두어야 하며, 현재 예시 파일도 false가 기본값이다.
|
||||||
|
- 회원가입은 이제 자동 로그인되지 않는다. 인증 메일 발송 후 `이메일 인증 후 로그인` 안내만 보여주고, 일반 사용자는 이메일 인증 전까지 로그인할 수 없다.
|
||||||
|
- 기존에 발급된 세션이라도 일반 사용자 이메일 인증이 안 되어 있으면 `/api/auth/me` 단계에서 세션을 즉시 폐기한다. 운영 중 인증 정책을 켠 뒤에도 미인증 세션이 남지 않게 하기 위한 장치다.
|
||||||
|
- 비밀번호 재설정/이메일 인증용 개발 링크는 `AUTH_PREVIEW_LINKS=true`여도 `APP_BASE_URL`이 `localhost` 또는 `127.0.0.1`일 때만 응답에 포함한다. 상용 서버에서 링크가 그대로 보이면 이 조건부터 확인한다.
|
||||||
|
- 프론트는 `/verify-email?token=...` 진입 시 인증을 바로 확정하고 로그인 모달에 결과 메시지를 띄운다. `/reset-password?token=...`은 기존처럼 비밀번호 재설정 모달을 연다.
|
||||||
|
- SETTINGS 화면에 일반 사용자 전용 `회원 탈퇴` 카드가 추가되었다. 현재 비밀번호 확인 후 계정, 플래너 기록, 목표, 세션, 인증 토큰이 함께 삭제된다. 기본 관리자 계정은 이 경로에서 삭제하지 못하게 막는다.
|
||||||
- `5173` 포트가 직접 `npm run dev` 없이 열려 있으면 대부분 `ten-minute-frontend-dev` 컨테이너가 떠 있는 상태다. 개발용 Docker를 끄려면 `docker compose -f docker-compose.dev.yml down`을 사용한다.
|
- `5173` 포트가 직접 `npm run dev` 없이 열려 있으면 대부분 `ten-minute-frontend-dev` 컨테이너가 떠 있는 상태다. 개발용 Docker를 끄려면 `docker compose -f docker-compose.dev.yml down`을 사용한다.
|
||||||
- 현재 환경에서는 Docker 데몬이 꺼져 있어서 `docker compose build` 실검증은 하지 못했고, 데몬 시작 후 다시 확인이 필요하다.
|
- 현재 환경에서는 Docker 데몬이 꺼져 있어서 `docker compose build` 실검증은 하지 못했고, 데몬 시작 후 다시 확인이 필요하다.
|
||||||
- 이미지 저장 기능은 추후 `print-only` 또는 별도 export 전용 레이아웃을 기준으로 구현하면 화면/인쇄/공유 결과를 맞추기 쉽다.
|
- 이미지 저장 기능은 추후 `print-only` 또는 별도 export 전용 레이아웃을 기준으로 구현하면 화면/인쇄/공유 결과를 맞추기 쉽다.
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ docker compose up -d --build
|
|||||||
|
|
||||||
관리자 계정은 백엔드 시작 시 `.env`의 `ADMIN_ACCOUNT_*` 값으로 자동 생성된다.
|
관리자 계정은 백엔드 시작 시 `.env`의 `ADMIN_ACCOUNT_*` 값으로 자동 생성된다.
|
||||||
관리자 아이디와 비밀번호는 저장소 문서에 적지 말고, 운영자만 접근 가능한 비공개 환경변수 파일에서 관리한다.
|
관리자 아이디와 비밀번호는 저장소 문서에 적지 말고, 운영자만 접근 가능한 비공개 환경변수 파일에서 관리한다.
|
||||||
일반 사용자는 기존처럼 회원가입 후 이메일로 로그인하면 된다.
|
일반 사용자는 회원가입 후 이메일 인증을 완료해야 로그인할 수 있다.
|
||||||
|
운영 서버에서는 비밀번호 재설정/이메일 인증용 미리보기 링크가 API 응답에 노출되지 않도록 유지한다.
|
||||||
|
|
||||||
현재 `docker-compose.yml` 기준 내부 구성:
|
현재 `docker-compose.yml` 기준 내부 구성:
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ const envSchema = z.object({
|
|||||||
CORS_ORIGIN: z.string().default('http://localhost:5173'),
|
CORS_ORIGIN: z.string().default('http://localhost:5173'),
|
||||||
SESSION_TTL_DAYS: z.coerce.number().default(30),
|
SESSION_TTL_DAYS: z.coerce.number().default(30),
|
||||||
APP_BASE_URL: z.string().default('http://localhost:5173'),
|
APP_BASE_URL: z.string().default('http://localhost:5173'),
|
||||||
|
RESEND_API_KEY: z.string().optional(),
|
||||||
|
MAIL_FROM_EMAIL: z.string().email().default('planner@sori.studio'),
|
||||||
|
MAIL_FROM_NAME: z.string().default('10 Minute Planner'),
|
||||||
|
AUTH_PREVIEW_LINKS: z.coerce.boolean().default(false),
|
||||||
ADMIN_ACCOUNT_ID: z.string().min(1),
|
ADMIN_ACCOUNT_ID: z.string().min(1),
|
||||||
ADMIN_ACCOUNT_PASSWORD: z.string().min(12),
|
ADMIN_ACCOUNT_PASSWORD: z.string().min(12),
|
||||||
ADMIN_ACCOUNT_EMAIL: z.string().email(),
|
ADMIN_ACCOUNT_EMAIL: z.string().email(),
|
||||||
|
|||||||
@@ -61,5 +61,10 @@ export async function findAuthenticatedUser(request) {
|
|||||||
.where(eq(users.id, session.userId))
|
.where(eq(users.id, session.userId))
|
||||||
.limit(1)
|
.limit(1)
|
||||||
|
|
||||||
|
if (user && user.role !== 'admin' && !user.emailVerifiedAt) {
|
||||||
|
await db.delete(authSessions).where(eq(authSessions.id, session.id))
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
return user ?? null
|
return user ?? null
|
||||||
}
|
}
|
||||||
|
|||||||
89
backend/src/lib/mailer.js
Normal file
89
backend/src/lib/mailer.js
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
import { env } from '../config.js'
|
||||||
|
|
||||||
|
const RESEND_API_URL = 'https://api.resend.com/emails'
|
||||||
|
|
||||||
|
function getFromAddress() {
|
||||||
|
return `${env.MAIL_FROM_NAME} <${env.MAIL_FROM_EMAIL}>`
|
||||||
|
}
|
||||||
|
|
||||||
|
async function sendWithResend({ to, subject, html, text }) {
|
||||||
|
if (!env.RESEND_API_KEY) {
|
||||||
|
return {
|
||||||
|
skipped: true,
|
||||||
|
reason: 'RESEND_API_KEY is not configured.',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await fetch(RESEND_API_URL, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${env.RESEND_API_KEY}`,
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'User-Agent': 'ten-minute-planner/1.0',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
from: getFromAddress(),
|
||||||
|
to,
|
||||||
|
subject,
|
||||||
|
html,
|
||||||
|
text,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
const data = await response.json().catch(() => ({}))
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(data.message || data.error?.message || 'Resend 메일 발송에 실패했습니다.')
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
skipped: false,
|
||||||
|
id: data.id,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildLinkHtml({ title, description, linkUrl, buttonLabel }) {
|
||||||
|
return `
|
||||||
|
<div style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #1c1917; line-height: 1.6;">
|
||||||
|
<p style="font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: #78716c;">10 Minute Planner</p>
|
||||||
|
<h1 style="font-size: 24px; margin: 12px 0;">${title}</h1>
|
||||||
|
<p style="font-size: 15px; color: #57534e;">${description}</p>
|
||||||
|
<p style="margin: 24px 0;">
|
||||||
|
<a href="${linkUrl}" style="display: inline-block; border-radius: 999px; background: #1c1917; color: #ffffff; padding: 12px 18px; font-size: 13px; font-weight: 700; text-decoration: none;">
|
||||||
|
${buttonLabel}
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<p style="font-size: 12px; color: #78716c;">버튼이 열리지 않으면 아래 링크를 복사해서 브라우저에 붙여넣어 주세요.</p>
|
||||||
|
<p style="font-size: 12px; word-break: break-all; color: #57534e;">${linkUrl}</p>
|
||||||
|
<p style="font-size: 12px; color: #a8a29e;">이 링크는 30분 동안 사용할 수 있습니다.</p>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function sendVerificationEmail({ to, linkUrl }) {
|
||||||
|
return sendWithResend({
|
||||||
|
to,
|
||||||
|
subject: '[10 Minute Planner] 이메일 인증',
|
||||||
|
html: buildLinkHtml({
|
||||||
|
title: '이메일 인증을 완료해 주세요.',
|
||||||
|
description: '아래 버튼을 눌러 10 Minute Planner 계정의 이메일 인증을 완료할 수 있습니다.',
|
||||||
|
linkUrl,
|
||||||
|
buttonLabel: '이메일 인증하기',
|
||||||
|
}),
|
||||||
|
text: `10 Minute Planner 이메일 인증 링크입니다.\n${linkUrl}\n이 링크는 30분 동안 사용할 수 있습니다.`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function sendPasswordResetEmail({ to, linkUrl }) {
|
||||||
|
return sendWithResend({
|
||||||
|
to,
|
||||||
|
subject: '[10 Minute Planner] 비밀번호 재설정',
|
||||||
|
html: buildLinkHtml({
|
||||||
|
title: '비밀번호를 재설정해 주세요.',
|
||||||
|
description: '아래 버튼을 눌러 새 비밀번호를 설정할 수 있습니다. 요청하지 않았다면 이 메일은 무시해 주세요.',
|
||||||
|
linkUrl,
|
||||||
|
buttonLabel: '비밀번호 재설정',
|
||||||
|
}),
|
||||||
|
text: `10 Minute Planner 비밀번호 재설정 링크입니다.\n${linkUrl}\n요청하지 않았다면 이 메일은 무시해 주세요.`,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import { db } from '../db/client.js'
|
|||||||
import { authSessions, emailVerificationTokens, passwordResetTokens, users } from '../db/schema.js'
|
import { authSessions, emailVerificationTokens, passwordResetTokens, users } from '../db/schema.js'
|
||||||
import { createSessionToken, hashSessionToken, hashPassword, verifyPassword } from '../lib/password.js'
|
import { createSessionToken, hashSessionToken, hashPassword, verifyPassword } from '../lib/password.js'
|
||||||
import { createSession, findAuthenticatedUser } from '../lib/authSession.js'
|
import { createSession, findAuthenticatedUser } from '../lib/authSession.js'
|
||||||
|
import { sendPasswordResetEmail, sendVerificationEmail } from '../lib/mailer.js'
|
||||||
import { env } from '../config.js'
|
import { env } from '../config.js'
|
||||||
|
|
||||||
const signupSchema = z.object({
|
const signupSchema = z.object({
|
||||||
@@ -27,6 +28,10 @@ const passwordSchema = z.object({
|
|||||||
newPassword: z.string().min(8).max(72),
|
newPassword: z.string().min(8).max(72),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const deleteAccountSchema = z.object({
|
||||||
|
currentPassword: z.string().min(1).max(72),
|
||||||
|
})
|
||||||
|
|
||||||
const verificationRequestSchema = z.object({
|
const verificationRequestSchema = z.object({
|
||||||
email: z.string().trim().email().optional(),
|
email: z.string().trim().email().optional(),
|
||||||
})
|
})
|
||||||
@@ -108,6 +113,31 @@ function sanitizeUser(user) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function withPreviewUrl(payload, key, previewUrl) {
|
||||||
|
const allowPreviewLinks =
|
||||||
|
env.AUTH_PREVIEW_LINKS &&
|
||||||
|
/localhost|127\.0\.0\.1/i.test(env.APP_BASE_URL)
|
||||||
|
|
||||||
|
if (!allowPreviewLinks) {
|
||||||
|
return payload
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...payload,
|
||||||
|
[key]: previewUrl,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findUserByNickname(nickname) {
|
||||||
|
const [user] = await db
|
||||||
|
.select()
|
||||||
|
.from(users)
|
||||||
|
.where(eq(users.nickname, nickname))
|
||||||
|
.limit(1)
|
||||||
|
|
||||||
|
return user ?? null
|
||||||
|
}
|
||||||
|
|
||||||
export async function registerAuthRoutes(app) {
|
export async function registerAuthRoutes(app) {
|
||||||
app.post('/api/auth/signup', async (request, reply) => {
|
app.post('/api/auth/signup', async (request, reply) => {
|
||||||
const payload = signupSchema.safeParse(request.body)
|
const payload = signupSchema.safeParse(request.body)
|
||||||
@@ -134,6 +164,14 @@ export async function registerAuthRoutes(app) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const existingNicknameUser = await findUserByNickname(nickname)
|
||||||
|
|
||||||
|
if (existingNicknameUser) {
|
||||||
|
return reply.code(409).send({
|
||||||
|
message: '이미 사용 중인 닉네임입니다.',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
const passwordHash = await hashPassword(password)
|
const passwordHash = await hashPassword(password)
|
||||||
const [user] = await db
|
const [user] = await db
|
||||||
@@ -145,21 +183,22 @@ export async function registerAuthRoutes(app) {
|
|||||||
nickname,
|
nickname,
|
||||||
role: 'user',
|
role: 'user',
|
||||||
emailVerifiedAt: null,
|
emailVerifiedAt: null,
|
||||||
lastLoginAt: now,
|
lastLoginAt: null,
|
||||||
createdAt: now,
|
createdAt: now,
|
||||||
updatedAt: now,
|
updatedAt: now,
|
||||||
})
|
})
|
||||||
.returning()
|
.returning()
|
||||||
|
|
||||||
const { token } = await createSession(user.id)
|
|
||||||
const verification = await createEmailVerificationToken(user.id)
|
const verification = await createEmailVerificationToken(user.id)
|
||||||
|
await sendVerificationEmail({
|
||||||
return reply.code(201).send({
|
to: user.email,
|
||||||
message: '회원가입이 완료되었습니다.',
|
linkUrl: verification.previewUrl,
|
||||||
token,
|
|
||||||
user: sanitizeUser(user),
|
|
||||||
verificationPreviewUrl: verification.previewUrl,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
return reply.code(201).send(withPreviewUrl({
|
||||||
|
message: '회원가입이 완료되었습니다. 이메일 인증 후 로그인해 주세요.',
|
||||||
|
requiresEmailVerification: true,
|
||||||
|
}, 'verificationPreviewUrl', verification.previewUrl))
|
||||||
})
|
})
|
||||||
|
|
||||||
app.post('/api/auth/login', async (request, reply) => {
|
app.post('/api/auth/login', async (request, reply) => {
|
||||||
@@ -200,6 +239,12 @@ export async function registerAuthRoutes(app) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user.role !== 'admin' && !user.emailVerifiedAt) {
|
||||||
|
return reply.code(403).send({
|
||||||
|
message: '이메일 인증을 완료한 뒤 로그인해 주세요.',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
|
|
||||||
const [updatedUser] = await db
|
const [updatedUser] = await db
|
||||||
@@ -266,6 +311,14 @@ export async function registerAuthRoutes(app) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const existingNicknameUser = await findUserByNickname(payload.data.nickname)
|
||||||
|
|
||||||
|
if (existingNicknameUser && existingNicknameUser.id !== user.id) {
|
||||||
|
return reply.code(409).send({
|
||||||
|
message: '이미 사용 중인 닉네임입니다.',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const [updatedUser] = await db
|
const [updatedUser] = await db
|
||||||
.update(users)
|
.update(users)
|
||||||
.set({
|
.set({
|
||||||
@@ -323,6 +376,46 @@ export async function registerAuthRoutes(app) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.delete('/api/auth/account', async (request, reply) => {
|
||||||
|
const user = await findAuthenticatedUser(request)
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
return reply.code(401).send({
|
||||||
|
message: '인증이 필요합니다.',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user.role === 'admin') {
|
||||||
|
return reply.code(403).send({
|
||||||
|
message: '기본 관리자 계정은 여기서 삭제할 수 없습니다.',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const payload = deleteAccountSchema.safeParse(request.body)
|
||||||
|
|
||||||
|
if (!payload.success) {
|
||||||
|
return reply.code(400).send({
|
||||||
|
message: '회원 탈퇴 확인 비밀번호를 입력해 주세요.',
|
||||||
|
issues: payload.error.flatten(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const passwordMatches = await verifyPassword(payload.data.currentPassword, user.passwordHash)
|
||||||
|
|
||||||
|
if (!passwordMatches) {
|
||||||
|
return reply.code(401).send({
|
||||||
|
message: '현재 비밀번호가 올바르지 않습니다.',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
await db.delete(authSessions).where(eq(authSessions.userId, user.id))
|
||||||
|
await db.delete(users).where(eq(users.id, user.id))
|
||||||
|
|
||||||
|
return {
|
||||||
|
message: '회원 탈퇴가 완료되었습니다.',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
app.post('/api/auth/verification/request', async (request, reply) => {
|
app.post('/api/auth/verification/request', async (request, reply) => {
|
||||||
const authenticatedUser = await findAuthenticatedUser(request)
|
const authenticatedUser = await findAuthenticatedUser(request)
|
||||||
const payload = verificationRequestSchema.safeParse(request.body ?? {})
|
const payload = verificationRequestSchema.safeParse(request.body ?? {})
|
||||||
@@ -361,11 +454,14 @@ export async function registerAuthRoutes(app) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const verification = await createEmailVerificationToken(user.id)
|
const verification = await createEmailVerificationToken(user.id)
|
||||||
|
await sendVerificationEmail({
|
||||||
|
to: user.email,
|
||||||
|
linkUrl: verification.previewUrl,
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return withPreviewUrl({
|
||||||
message: '이메일 인증 링크를 준비했습니다.',
|
message: '이메일 인증 링크를 준비했습니다.',
|
||||||
verificationPreviewUrl: verification.previewUrl,
|
}, 'verificationPreviewUrl', verification.previewUrl)
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
app.post('/api/auth/verification/confirm', async (request, reply) => {
|
app.post('/api/auth/verification/confirm', async (request, reply) => {
|
||||||
@@ -445,11 +541,14 @@ export async function registerAuthRoutes(app) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const reset = await createPasswordResetToken(user.id)
|
const reset = await createPasswordResetToken(user.id)
|
||||||
|
await sendPasswordResetEmail({
|
||||||
|
to: user.email,
|
||||||
|
linkUrl: reset.previewUrl,
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return withPreviewUrl({
|
||||||
message: '비밀번호 재설정 링크를 준비했습니다.',
|
message: '비밀번호 재설정 링크를 준비했습니다.',
|
||||||
resetPreviewUrl: reset.previewUrl,
|
}, 'resetPreviewUrl', reset.previewUrl)
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
app.post('/api/auth/password-reset/confirm', async (request, reply) => {
|
app.post('/api/auth/password-reset/confirm', async (request, reply) => {
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "ten-minute-planner",
|
"name": "ten-minute-planner",
|
||||||
"version": "0.1.42",
|
"version": "0.1.43",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ten-minute-planner",
|
"name": "ten-minute-planner",
|
||||||
"version": "0.1.42",
|
"version": "0.1.43",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"vue": "^3.5.13"
|
"vue": "^3.5.13"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ten-minute-planner",
|
"name": "ten-minute-planner",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.1.42",
|
"version": "0.1.43",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
517
src/App.vue
517
src/App.vue
@@ -11,10 +11,14 @@ import StatsDashboard from './components/StatsDashboard.vue'
|
|||||||
import { fetchAdminOverview } from './lib/adminApi'
|
import { fetchAdminOverview } from './lib/adminApi'
|
||||||
import {
|
import {
|
||||||
clearAuthState,
|
clearAuthState,
|
||||||
|
confirmVerification,
|
||||||
|
deleteAccount,
|
||||||
fetchCurrentUser,
|
fetchCurrentUser,
|
||||||
|
confirmPasswordReset,
|
||||||
login,
|
login,
|
||||||
persistAuthState,
|
persistAuthState,
|
||||||
readAuthState,
|
readAuthState,
|
||||||
|
requestPasswordReset,
|
||||||
signup,
|
signup,
|
||||||
updatePassword,
|
updatePassword,
|
||||||
updateProfile,
|
updateProfile,
|
||||||
@@ -36,6 +40,7 @@ const CARRYOVER_CHECK_POLICIES = ['ask', 'all', 'current']
|
|||||||
const screenMode = ref('planner')
|
const screenMode = ref('planner')
|
||||||
const viewMode = ref('focus')
|
const viewMode = ref('focus')
|
||||||
const printLayout = ref('single')
|
const printLayout = ref('single')
|
||||||
|
const printDialogOpen = ref(false)
|
||||||
const demoMode = ref(false)
|
const demoMode = ref(false)
|
||||||
const demoDayOffset = ref(0)
|
const demoDayOffset = ref(0)
|
||||||
const authDialogOpen = ref(false)
|
const authDialogOpen = ref(false)
|
||||||
@@ -59,10 +64,15 @@ const leftPanelOpen = ref(false)
|
|||||||
const rightPanelOpen = ref(false)
|
const rightPanelOpen = ref(false)
|
||||||
const statsRangeStart = ref(toKey(new Date(new Date().setDate(new Date().getDate() - 6))))
|
const statsRangeStart = ref(toKey(new Date(new Date().setDate(new Date().getDate() - 6))))
|
||||||
const statsRangeEnd = ref(toKey(new Date()))
|
const statsRangeEnd = ref(toKey(new Date()))
|
||||||
|
const printRangeStart = ref(toKey(new Date()))
|
||||||
|
const printRangeEnd = ref(toKey(new Date()))
|
||||||
|
const printRangeLayout = ref('single')
|
||||||
const authForm = reactive({
|
const authForm = reactive({
|
||||||
nickname: '',
|
nickname: '',
|
||||||
email: '',
|
email: '',
|
||||||
password: '',
|
password: '',
|
||||||
|
resetToken: '',
|
||||||
|
newPassword: '',
|
||||||
rememberSession: false,
|
rememberSession: false,
|
||||||
})
|
})
|
||||||
const goalForm = reactive({
|
const goalForm = reactive({
|
||||||
@@ -80,10 +90,15 @@ const passwordForm = reactive({
|
|||||||
newPassword: '',
|
newPassword: '',
|
||||||
confirmPassword: '',
|
confirmPassword: '',
|
||||||
})
|
})
|
||||||
|
const accountDeleteForm = reactive({
|
||||||
|
currentPassword: '',
|
||||||
|
})
|
||||||
const profileBusy = ref(false)
|
const profileBusy = ref(false)
|
||||||
const passwordBusy = ref(false)
|
const passwordBusy = ref(false)
|
||||||
const profileMessage = ref('')
|
const profileMessage = ref('')
|
||||||
const passwordMessage = ref('')
|
const passwordMessage = ref('')
|
||||||
|
const accountDeleteBusy = ref(false)
|
||||||
|
const accountDeleteMessage = ref('')
|
||||||
const carryoverMessage = ref('')
|
const carryoverMessage = ref('')
|
||||||
const carryoverCheckPolicy = ref(readCarryoverCheckPolicy())
|
const carryoverCheckPolicy = ref(readCarryoverCheckPolicy())
|
||||||
const carryoverCheckPrompt = ref(null)
|
const carryoverCheckPrompt = ref(null)
|
||||||
@@ -550,6 +565,56 @@ const calendarDays = computed(() => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const normalizedPrintRange = computed(() => {
|
||||||
|
const startKey = printRangeStart.value || toKey(selectedDate.value)
|
||||||
|
const endKey = printRangeEnd.value || startKey
|
||||||
|
|
||||||
|
if (startKey <= endKey) {
|
||||||
|
return { startKey, endKey }
|
||||||
|
}
|
||||||
|
|
||||||
|
return { startKey: endKey, endKey: startKey }
|
||||||
|
})
|
||||||
|
|
||||||
|
const printDateKeys = computed(() => {
|
||||||
|
const dateKeys = []
|
||||||
|
const currentDate = startOfDay(toDateValue(normalizedPrintRange.value.startKey))
|
||||||
|
const endDate = startOfDay(toDateValue(normalizedPrintRange.value.endKey))
|
||||||
|
|
||||||
|
while (currentDate <= endDate) {
|
||||||
|
dateKeys.push(toKey(currentDate))
|
||||||
|
currentDate.setDate(currentDate.getDate() + 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return dateKeys
|
||||||
|
})
|
||||||
|
|
||||||
|
const printPages = computed(() =>
|
||||||
|
printDateKeys.value.map((dateKey) => createPrintPage(dateKey)),
|
||||||
|
)
|
||||||
|
|
||||||
|
const printPapers = computed(() => {
|
||||||
|
if (printLayout.value === 'single') {
|
||||||
|
return printPages.value.map((page) => [page])
|
||||||
|
}
|
||||||
|
|
||||||
|
const papers = []
|
||||||
|
|
||||||
|
for (let index = 0; index < printPages.value.length; index += 2) {
|
||||||
|
papers.push(printPages.value.slice(index, index + 2))
|
||||||
|
}
|
||||||
|
|
||||||
|
return papers
|
||||||
|
})
|
||||||
|
|
||||||
|
const printPageCountLabel = computed(() => {
|
||||||
|
const dayCount = printDateKeys.value.length
|
||||||
|
const paperCount = printRangeLayout.value === 'double' ? Math.ceil(dayCount / 2) : dayCount
|
||||||
|
const layoutLabel = printRangeLayout.value === 'double' ? '2페이지씩' : '1페이지씩'
|
||||||
|
|
||||||
|
return `${dayCount}일치 / ${paperCount}장 (${layoutLabel})`
|
||||||
|
})
|
||||||
|
|
||||||
const markedDateKeys = computed(() =>
|
const markedDateKeys = computed(() =>
|
||||||
Object.entries(plannerRecords)
|
Object.entries(plannerRecords)
|
||||||
.filter(([, record]) => hasPlannerContent(record))
|
.filter(([, record]) => hasPlannerContent(record))
|
||||||
@@ -801,6 +866,12 @@ function closeCarryoverCheckPrompt() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleGlobalKeydown(event) {
|
function handleGlobalKeydown(event) {
|
||||||
|
if (event.key === 'Escape' && printDialogOpen.value) {
|
||||||
|
event.preventDefault()
|
||||||
|
closePrintDialog()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (event.key === 'Escape' && carryoverCheckPrompt.value) {
|
if (event.key === 'Escape' && carryoverCheckPrompt.value) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
closeCarryoverCheckPrompt()
|
closeCarryoverCheckPrompt()
|
||||||
@@ -971,6 +1042,56 @@ function createDateLabel(dateKey) {
|
|||||||
return `${display.main} ${display.weekday}`
|
return `${display.main} ${display.weekday}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function findPlannerGoalForDate(dateKey) {
|
||||||
|
const activeGoals = goals.value
|
||||||
|
.filter((goal) => {
|
||||||
|
if (!goal.activeFrom || !goal.activeUntil) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return dateKey >= goal.activeFrom && dateKey <= goal.activeUntil
|
||||||
|
})
|
||||||
|
.sort((left, right) => {
|
||||||
|
const currentDate = startOfDay(toDateValue(dateKey))
|
||||||
|
const leftDistance = Math.abs(startOfDay(toDateValue(left.targetDate)).getTime() - currentDate.getTime())
|
||||||
|
const rightDistance = Math.abs(startOfDay(toDateValue(right.targetDate)).getTime() - currentDate.getTime())
|
||||||
|
return leftDistance - rightDistance
|
||||||
|
})
|
||||||
|
|
||||||
|
return activeGoals[0] ?? null
|
||||||
|
}
|
||||||
|
|
||||||
|
function createPlannerDdayForDate(dateKey) {
|
||||||
|
if (isDdayDisabledForDate(dateKey)) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
const goal = findPlannerGoalForDate(dateKey)
|
||||||
|
|
||||||
|
if (!goal) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
const targetDate = startOfDay(toDateValue(goal.targetDate))
|
||||||
|
const currentDate = startOfDay(toDateValue(dateKey))
|
||||||
|
const diffDays = Math.round((targetDate.getTime() - currentDate.getTime()) / (24 * 60 * 60 * 1000))
|
||||||
|
const badge =
|
||||||
|
diffDays === 0 ? 'D-DAY' : diffDays > 0 ? `D-${diffDays}` : `D+${Math.abs(diffDays)}`
|
||||||
|
|
||||||
|
return `${badge} ${goal.title}`
|
||||||
|
}
|
||||||
|
|
||||||
|
function createPrintPage(dateKey) {
|
||||||
|
const date = toDateValue(dateKey)
|
||||||
|
|
||||||
|
return {
|
||||||
|
key: dateKey,
|
||||||
|
display: getDateDisplay(date),
|
||||||
|
record: getPlannerRecord(date),
|
||||||
|
dday: createPlannerDdayForDate(dateKey),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const weeklyRecords = computed(() => {
|
const weeklyRecords = computed(() => {
|
||||||
const entries = rangeEntries.value.map(([key, record]) => {
|
const entries = rangeEntries.value.map(([key, record]) => {
|
||||||
const date = toDateValue(key)
|
const date = toDateValue(key)
|
||||||
@@ -1211,6 +1332,19 @@ function closeRightPanel() {
|
|||||||
rightPanelOpen.value = false
|
rightPanelOpen.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openPrintDialog() {
|
||||||
|
const selectedKey = toKey(selectedDate.value)
|
||||||
|
printRangeStart.value = selectedKey
|
||||||
|
printRangeEnd.value = selectedKey
|
||||||
|
printRangeLayout.value = viewMode.value === 'spread' ? 'double' : 'single'
|
||||||
|
printDialogOpen.value = true
|
||||||
|
closeLeftPanel()
|
||||||
|
}
|
||||||
|
|
||||||
|
function closePrintDialog() {
|
||||||
|
printDialogOpen.value = false
|
||||||
|
}
|
||||||
|
|
||||||
function applyStatsQuickRange(days) {
|
function applyStatsQuickRange(days) {
|
||||||
const endDate = new Date()
|
const endDate = new Date()
|
||||||
const startDate = new Date(endDate)
|
const startDate = new Date(endDate)
|
||||||
@@ -1292,6 +1426,8 @@ function resetAuthForm() {
|
|||||||
authForm.nickname = ''
|
authForm.nickname = ''
|
||||||
authForm.email = ''
|
authForm.email = ''
|
||||||
authForm.password = ''
|
authForm.password = ''
|
||||||
|
authForm.resetToken = ''
|
||||||
|
authForm.newPassword = ''
|
||||||
authForm.rememberSession = false
|
authForm.rememberSession = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1314,12 +1450,76 @@ function resetPasswordForm() {
|
|||||||
passwordForm.confirmPassword = ''
|
passwordForm.confirmPassword = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetAccountDeleteForm() {
|
||||||
|
accountDeleteForm.currentPassword = ''
|
||||||
|
}
|
||||||
|
|
||||||
function openAuthDialog(mode = 'login') {
|
function openAuthDialog(mode = 'login') {
|
||||||
authMode.value = mode
|
authMode.value = mode
|
||||||
authMessage.value = ''
|
authMessage.value = ''
|
||||||
authDialogOpen.value = true
|
authDialogOpen.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openPasswordResetFromUrl() {
|
||||||
|
if (typeof window === 'undefined') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const url = new URL(window.location.href)
|
||||||
|
|
||||||
|
if (!url.pathname.includes('reset-password')) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const token = url.searchParams.get('token') ?? ''
|
||||||
|
|
||||||
|
if (!token) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
authForm.resetToken = token
|
||||||
|
authMode.value = 'reset-confirm'
|
||||||
|
authMessage.value = ''
|
||||||
|
authDialogOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
async function openVerificationFromUrl() {
|
||||||
|
if (typeof window === 'undefined') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const url = new URL(window.location.href)
|
||||||
|
|
||||||
|
if (!url.pathname.includes('verify-email')) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const token = url.searchParams.get('token') ?? ''
|
||||||
|
|
||||||
|
if (!token) {
|
||||||
|
authMode.value = 'login'
|
||||||
|
authMessage.value = '이메일 인증 링크가 올바르지 않습니다.'
|
||||||
|
authDialogOpen.value = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
authBusy.value = true
|
||||||
|
authMode.value = 'login'
|
||||||
|
authDialogOpen.value = true
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await confirmVerification({ token })
|
||||||
|
authMessage.value = result.message || '이메일 인증이 완료되었습니다. 이제 로그인할 수 있습니다.'
|
||||||
|
url.pathname = '/'
|
||||||
|
url.search = ''
|
||||||
|
window.history.replaceState({}, '', url.toString())
|
||||||
|
} catch (error) {
|
||||||
|
authMessage.value = toUserFacingApiError(error, '이메일 인증 링크를 처리하지 못했습니다.')
|
||||||
|
} finally {
|
||||||
|
authBusy.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function closeAuthDialog() {
|
function closeAuthDialog() {
|
||||||
authDialogOpen.value = false
|
authDialogOpen.value = false
|
||||||
authMessage.value = ''
|
authMessage.value = ''
|
||||||
@@ -1351,19 +1551,48 @@ async function submitAuthForm() {
|
|||||||
authMessage.value = ''
|
authMessage.value = ''
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result =
|
if (authMode.value === 'reset-request') {
|
||||||
authMode.value === 'login'
|
const result = await requestPasswordReset({
|
||||||
? await login({
|
email: authForm.email,
|
||||||
email: authForm.email,
|
})
|
||||||
password: authForm.password,
|
authMessage.value = result.resetPreviewUrl
|
||||||
})
|
? `${result.message} 개발용 링크: ${result.resetPreviewUrl}`
|
||||||
: await signup({
|
: result.message
|
||||||
nickname: authForm.nickname,
|
return
|
||||||
email: authForm.email,
|
}
|
||||||
password: authForm.password,
|
|
||||||
})
|
|
||||||
|
|
||||||
await applyAuthSuccess(result, authMode.value === 'login' && authForm.rememberSession)
|
if (authMode.value === 'reset-confirm') {
|
||||||
|
const result = await confirmPasswordReset({
|
||||||
|
token: authForm.resetToken,
|
||||||
|
newPassword: authForm.newPassword,
|
||||||
|
})
|
||||||
|
authMode.value = 'login'
|
||||||
|
authForm.password = ''
|
||||||
|
authForm.newPassword = ''
|
||||||
|
authForm.resetToken = ''
|
||||||
|
authMessage.value = result.message
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = authMode.value === 'login'
|
||||||
|
? await login({
|
||||||
|
email: authForm.email,
|
||||||
|
password: authForm.password,
|
||||||
|
})
|
||||||
|
: await signup({
|
||||||
|
nickname: authForm.nickname,
|
||||||
|
email: authForm.email,
|
||||||
|
password: authForm.password,
|
||||||
|
})
|
||||||
|
|
||||||
|
if (authMode.value === 'signup') {
|
||||||
|
authMode.value = 'login'
|
||||||
|
authForm.password = ''
|
||||||
|
authMessage.value = result.message
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
await applyAuthSuccess(result, authForm.rememberSession)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
authMessage.value = toUserFacingApiError(error, '인증 처리 중 문제가 발생했습니다.')
|
authMessage.value = toUserFacingApiError(error, '인증 처리 중 문제가 발생했습니다.')
|
||||||
} finally {
|
} finally {
|
||||||
@@ -1414,6 +1643,7 @@ function logout() {
|
|||||||
adminMessage.value = ''
|
adminMessage.value = ''
|
||||||
adminUsers.value = []
|
adminUsers.value = []
|
||||||
adminRecentLogins.value = []
|
adminRecentLogins.value = []
|
||||||
|
accountDeleteMessage.value = ''
|
||||||
adminOverview.value = {
|
adminOverview.value = {
|
||||||
totalUsers: 0,
|
totalUsers: 0,
|
||||||
totalAdmins: 0,
|
totalAdmins: 0,
|
||||||
@@ -1433,6 +1663,7 @@ function logout() {
|
|||||||
restoreLocalPlannerRecords()
|
restoreLocalPlannerRecords()
|
||||||
resetGoalForm()
|
resetGoalForm()
|
||||||
resetPasswordForm()
|
resetPasswordForm()
|
||||||
|
resetAccountDeleteForm()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadAdminDashboard() {
|
async function loadAdminDashboard() {
|
||||||
@@ -1632,6 +1863,10 @@ function updatePasswordField({ field, value }) {
|
|||||||
passwordForm[field] = value
|
passwordForm[field] = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateAccountDeleteField({ field, value }) {
|
||||||
|
accountDeleteForm[field] = value
|
||||||
|
}
|
||||||
|
|
||||||
async function submitProfileForm() {
|
async function submitProfileForm() {
|
||||||
profileBusy.value = true
|
profileBusy.value = true
|
||||||
profileMessage.value = ''
|
profileMessage.value = ''
|
||||||
@@ -1688,6 +1923,36 @@ async function submitPasswordForm() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function submitDeleteAccount() {
|
||||||
|
if (!accountDeleteForm.currentPassword) {
|
||||||
|
accountDeleteMessage.value = '회원 탈퇴를 위해 현재 비밀번호를 입력해 주세요.'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const confirmed = window.confirm('정말로 회원 탈퇴하시겠습니까? 작성한 플래너와 목표 데이터도 함께 삭제됩니다.')
|
||||||
|
|
||||||
|
if (!confirmed) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
accountDeleteBusy.value = true
|
||||||
|
accountDeleteMessage.value = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await deleteAccount(authToken.value, {
|
||||||
|
currentPassword: accountDeleteForm.currentPassword,
|
||||||
|
})
|
||||||
|
resetAccountDeleteForm()
|
||||||
|
logout()
|
||||||
|
authMessage.value = ''
|
||||||
|
window.alert(result.message || '회원 탈퇴가 완료되었습니다.')
|
||||||
|
} catch (error) {
|
||||||
|
accountDeleteMessage.value = error.message || '회원 탈퇴를 처리하지 못했습니다.'
|
||||||
|
} finally {
|
||||||
|
accountDeleteBusy.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function replacePlannerRecords(nextRecords) {
|
function replacePlannerRecords(nextRecords) {
|
||||||
Object.keys(plannerRecords).forEach((key) => {
|
Object.keys(plannerRecords).forEach((key) => {
|
||||||
delete plannerRecords[key]
|
delete plannerRecords[key]
|
||||||
@@ -1845,6 +2110,19 @@ async function printSelectedPlanner(layout = 'single') {
|
|||||||
window.print()
|
window.print()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function printPlannerRange() {
|
||||||
|
printLayout.value = printRangeLayout.value
|
||||||
|
applyPrintPageStyle(printRangeLayout.value)
|
||||||
|
await nextTick()
|
||||||
|
window.print()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function initializeAppSession() {
|
||||||
|
await openVerificationFromUrl()
|
||||||
|
openPasswordResetFromUrl()
|
||||||
|
await restoreAuthSession()
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
resetGoalForm()
|
resetGoalForm()
|
||||||
setSyncFeedback('local', '로그인 후 클라우드 저장을 사용할 수 있습니다.', {
|
setSyncFeedback('local', '로그인 후 클라우드 저장을 사용할 수 있습니다.', {
|
||||||
@@ -1853,7 +2131,7 @@ onMounted(() => {
|
|||||||
updateWindowWidth()
|
updateWindowWidth()
|
||||||
window.addEventListener('resize', updateWindowWidth)
|
window.addEventListener('resize', updateWindowWidth)
|
||||||
window.addEventListener('keydown', handleGlobalKeydown)
|
window.addEventListener('keydown', handleGlobalKeydown)
|
||||||
restoreAuthSession()
|
initializeAppSession()
|
||||||
})
|
})
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
@@ -2058,16 +2336,9 @@ onBeforeUnmount(() => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="rounded-2xl border border-stone-200 px-4 py-3 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
class="rounded-2xl border border-stone-200 px-4 py-3 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
||||||
@click="printSelectedPlanner('single')"
|
@click="openPrintDialog"
|
||||||
>
|
>
|
||||||
1장 인쇄
|
PRINT
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="rounded-2xl border border-stone-200 px-4 py-3 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
|
||||||
@click="printSelectedPlanner('double')"
|
|
||||||
>
|
|
||||||
2장 인쇄
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -2097,9 +2368,6 @@ onBeforeUnmount(() => {
|
|||||||
<div class="overflow-hidden rounded-[28px] border border-stone-200 bg-[linear-gradient(145deg,rgba(255,255,255,0.96),rgba(246,238,228,0.92))] p-5 shadow-[0_18px_40px_rgba(28,25,23,0.06)]">
|
<div class="overflow-hidden rounded-[28px] border border-stone-200 bg-[linear-gradient(145deg,rgba(255,255,255,0.96),rgba(246,238,228,0.92))] p-5 shadow-[0_18px_40px_rgba(28,25,23,0.06)]">
|
||||||
<div class="flex items-center justify-between gap-3">
|
<div class="flex items-center justify-between gap-3">
|
||||||
<p class="text-[11px] font-bold uppercase tracking-[0.28em] text-stone-500">10 Minute Planner</p>
|
<p class="text-[11px] font-bold uppercase tracking-[0.28em] text-stone-500">10 Minute Planner</p>
|
||||||
<span class="rounded-full border border-stone-200 bg-white/80 px-3 py-1 text-[10px] font-bold tracking-[0.18em] text-stone-500">
|
|
||||||
DAILY FLOW
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-6 space-y-3">
|
<div class="mt-6 space-y-3">
|
||||||
<h1 class="text-[28px] font-semibold leading-[1.1] tracking-[-0.06em] text-stone-900">
|
<h1 class="text-[28px] font-semibold leading-[1.1] tracking-[-0.06em] text-stone-900">
|
||||||
@@ -2226,16 +2494,9 @@ onBeforeUnmount(() => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="rounded-2xl border border-stone-200 px-4 py-3 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
class="rounded-2xl border border-stone-200 px-4 py-3 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
||||||
@click="printSelectedPlanner('single')"
|
@click="openPrintDialog"
|
||||||
>
|
>
|
||||||
1장 인쇄
|
PRINT
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="rounded-2xl border border-stone-200 px-4 py-3 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
|
||||||
@click="printSelectedPlanner('double')"
|
|
||||||
>
|
|
||||||
2장 인쇄
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -2255,7 +2516,7 @@ onBeforeUnmount(() => {
|
|||||||
10 MINITES PLANNER
|
10 MINITES PLANNER
|
||||||
</h2>
|
</h2>
|
||||||
<p class="mx-auto mt-3 max-w-xl text-sm leading-7 text-stone-600 sm:text-base">
|
<p class="mx-auto mt-3 max-w-xl text-sm leading-7 text-stone-600 sm:text-base">
|
||||||
장기 목표, 할 일, 집중 시간, 짧은 코멘트를 한 장의 다이어리로 남기고 내일의 첫 작업까지 이어가세요.
|
장기 목표, 할 일, 집중 시간, 짧은 코멘트를 한 장의 다이어리로 남기고<br />내일의 첫 작업까지 이어가세요.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -2796,13 +3057,18 @@ onBeforeUnmount(() => {
|
|||||||
:password-busy="passwordBusy"
|
:password-busy="passwordBusy"
|
||||||
:profile-message="profileMessage"
|
:profile-message="profileMessage"
|
||||||
:password-message="passwordMessage"
|
:password-message="passwordMessage"
|
||||||
|
:account-delete-form="accountDeleteForm"
|
||||||
|
:account-delete-busy="accountDeleteBusy"
|
||||||
|
:account-delete-message="accountDeleteMessage"
|
||||||
:guide-tooltip-reset-message="guideTooltipResetMessage"
|
:guide-tooltip-reset-message="guideTooltipResetMessage"
|
||||||
:carryover-check-policy="carryoverCheckPolicy"
|
:carryover-check-policy="carryoverCheckPolicy"
|
||||||
@update:profile-field="updateProfileField"
|
@update:profile-field="updateProfileField"
|
||||||
@update:password-field="updatePasswordField"
|
@update:password-field="updatePasswordField"
|
||||||
|
@update:account-delete-field="updateAccountDeleteField"
|
||||||
@update:carryover-check-policy="updateCarryoverCheckPolicy"
|
@update:carryover-check-policy="updateCarryoverCheckPolicy"
|
||||||
@submit:profile="submitProfileForm"
|
@submit:profile="submitProfileForm"
|
||||||
@submit:password="submitPasswordForm"
|
@submit:password="submitPasswordForm"
|
||||||
|
@submit:delete-account="submitDeleteAccount"
|
||||||
@reset-guide-tooltips="resetGuideTooltips"
|
@reset-guide-tooltips="resetGuideTooltips"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -2832,79 +3098,35 @@ onBeforeUnmount(() => {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<section v-if="isAuthenticated" class="print-only">
|
<section v-if="isAuthenticated" class="print-only">
|
||||||
<div v-if="printLayout === 'single'" class="print-paper print-paper--single">
|
<div
|
||||||
<div class="print-sheet-frame">
|
v-for="(paper, paperIndex) in printPapers"
|
||||||
|
:key="`${printLayout}-${paperIndex}`"
|
||||||
|
class="print-paper"
|
||||||
|
:class="printLayout === 'single' ? 'print-paper--single' : 'print-paper--double'"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
v-for="page in paper"
|
||||||
|
:key="page.key"
|
||||||
|
class="print-sheet-frame"
|
||||||
|
>
|
||||||
<PlannerPage
|
<PlannerPage
|
||||||
:date-main="selectedDateDisplay.main"
|
:date-main="page.display.main"
|
||||||
:date-weekday="selectedDateDisplay.weekday"
|
:date-weekday="page.display.weekday"
|
||||||
:date-weekday-tone="selectedDateDisplay.weekdayTone"
|
:date-weekday-tone="page.display.weekdayTone"
|
||||||
:dday="plannerDday"
|
:dday="page.dday"
|
||||||
:show-dday="showPlannerDday"
|
:show-dday="Boolean(page.dday)"
|
||||||
:comment="planner.comment"
|
:comment="page.record.comment"
|
||||||
:total-time="formatTotalTimeKorean(planner)"
|
:total-time="formatTotalTimeKorean(page.record)"
|
||||||
:tasks="planner.tasks"
|
:tasks="page.record.tasks"
|
||||||
:memo="planner.memo"
|
:memo="page.record.memo"
|
||||||
:hours="hours"
|
:hours="hours"
|
||||||
:timetable="planner.timetable"
|
:timetable="page.record.timetable"
|
||||||
@update:comment="updateComment(planner, $event)"
|
|
||||||
@update:task-label="updateTaskLabel(planner, $event)"
|
|
||||||
@update:task-title="updateTaskTitle(planner, $event)"
|
|
||||||
@toggle:task="toggleTask(planner, $event)"
|
|
||||||
@clear:tasks="clearTasks(planner, $event)"
|
|
||||||
@update:memo-label="updateMemoLabel(planner, $event)"
|
|
||||||
@update:memo="updateMemo(planner, $event)"
|
|
||||||
@update:timetable="updateTimetable(planner, $event)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-else class="print-paper print-paper--double">
|
|
||||||
<div class="print-sheet-frame">
|
|
||||||
<PlannerPage
|
|
||||||
:date-main="selectedDateDisplay.main"
|
|
||||||
:date-weekday="selectedDateDisplay.weekday"
|
|
||||||
:date-weekday-tone="selectedDateDisplay.weekdayTone"
|
|
||||||
:dday="plannerDday"
|
|
||||||
:show-dday="showPlannerDday"
|
|
||||||
:comment="planner.comment"
|
|
||||||
:total-time="formatTotalTimeKorean(planner)"
|
|
||||||
:tasks="planner.tasks"
|
|
||||||
:memo="planner.memo"
|
|
||||||
:hours="hours"
|
|
||||||
:timetable="planner.timetable"
|
|
||||||
@update:comment="updateComment(planner, $event)"
|
|
||||||
@update:task-label="updateTaskLabel(planner, $event)"
|
|
||||||
@update:task-title="updateTaskTitle(planner, $event)"
|
|
||||||
@toggle:task="toggleTask(planner, $event)"
|
|
||||||
@clear:tasks="clearTasks(planner, $event)"
|
|
||||||
@update:memo-label="updateMemoLabel(planner, $event)"
|
|
||||||
@update:memo="updateMemo(planner, $event)"
|
|
||||||
@update:timetable="updateTimetable(planner, $event)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="print-sheet-frame">
|
|
||||||
<PlannerPage
|
|
||||||
:date-main="secondaryDateDisplay.main"
|
|
||||||
:date-weekday="secondaryDateDisplay.weekday"
|
|
||||||
:date-weekday-tone="secondaryDateDisplay.weekdayTone"
|
|
||||||
:dday="''"
|
|
||||||
:show-dday="false"
|
|
||||||
:comment="secondaryPlanner.comment"
|
|
||||||
:total-time="formatTotalTimeKorean(secondaryPlanner)"
|
|
||||||
:tasks="secondaryPlanner.tasks"
|
|
||||||
:memo="secondaryPlanner.memo"
|
|
||||||
:hours="hours"
|
|
||||||
:timetable="secondaryPlanner.timetable"
|
|
||||||
@update:comment="updateComment(secondaryPlanner, $event)"
|
|
||||||
@update:task-label="updateTaskLabel(secondaryPlanner, $event)"
|
|
||||||
@update:task-title="updateTaskTitle(secondaryPlanner, $event)"
|
|
||||||
@toggle:task="toggleTask(secondaryPlanner, $event)"
|
|
||||||
@clear:tasks="clearTasks(secondaryPlanner, $event)"
|
|
||||||
@update:memo-label="updateMemoLabel(secondaryPlanner, $event)"
|
|
||||||
@update:memo="updateMemo(secondaryPlanner, $event)"
|
|
||||||
@update:timetable="updateTimetable(secondaryPlanner, $event)"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="printLayout === 'double' && paper.length === 1"
|
||||||
|
class="print-sheet-frame print-sheet-frame--blank"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
@@ -2922,6 +3144,93 @@ onBeforeUnmount(() => {
|
|||||||
@update:field="updateAuthField"
|
@update:field="updateAuthField"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="printDialogOpen"
|
||||||
|
class="print-hidden fixed inset-0 z-50 flex items-center justify-center bg-stone-900/45 px-4 py-6 backdrop-blur-sm"
|
||||||
|
@click.self="closePrintDialog"
|
||||||
|
>
|
||||||
|
<section class="w-full max-w-lg rounded-[30px] border border-white/70 bg-[#f7f2ea] p-5 shadow-[0_24px_80px_rgba(28,25,23,0.2)] sm:p-6">
|
||||||
|
<div class="flex items-start justify-between gap-4">
|
||||||
|
<div>
|
||||||
|
<p class="text-[10px] font-bold uppercase tracking-[0.24em] text-stone-500">Print Planner</p>
|
||||||
|
<h2 class="mt-3 text-2xl font-semibold tracking-[-0.05em] text-stone-900">
|
||||||
|
출력할 날짜 범위 선택
|
||||||
|
</h2>
|
||||||
|
<p class="mt-3 text-sm font-semibold leading-6 text-stone-600">
|
||||||
|
선택한 기간을 1페이지씩 또는 2페이지씩 묶어서 바로 출력합니다.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="rounded-full border border-stone-200 bg-white px-3 py-2 text-[10px] font-bold tracking-[0.14em] text-stone-500 transition hover:border-stone-400 hover:text-stone-900"
|
||||||
|
@click="closePrintDialog"
|
||||||
|
>
|
||||||
|
CLOSE
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-6 grid gap-4 sm:grid-cols-2">
|
||||||
|
<label class="flex flex-col gap-2 text-[11px] font-bold tracking-[0.14em] text-stone-500">
|
||||||
|
시작일
|
||||||
|
<input
|
||||||
|
v-model="printRangeStart"
|
||||||
|
type="date"
|
||||||
|
class="rounded-2xl border border-stone-200 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-400"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<label class="flex flex-col gap-2 text-[11px] font-bold tracking-[0.14em] text-stone-500">
|
||||||
|
종료일
|
||||||
|
<input
|
||||||
|
v-model="printRangeEnd"
|
||||||
|
type="date"
|
||||||
|
class="rounded-2xl border border-stone-200 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-400"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-5 grid gap-2 sm:grid-cols-2">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="rounded-2xl px-4 py-3 text-xs font-bold tracking-[0.14em] transition"
|
||||||
|
:class="printRangeLayout === 'single' ? 'bg-stone-900 text-white' : 'border border-stone-200 bg-white text-stone-500'"
|
||||||
|
@click="printRangeLayout = 'single'"
|
||||||
|
>
|
||||||
|
1페이지씩
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="rounded-2xl px-4 py-3 text-xs font-bold tracking-[0.14em] transition"
|
||||||
|
:class="printRangeLayout === 'double' ? 'bg-stone-900 text-white' : 'border border-stone-200 bg-white text-stone-500'"
|
||||||
|
@click="printRangeLayout = 'double'"
|
||||||
|
>
|
||||||
|
2페이지씩
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-5 rounded-2xl border border-stone-200 bg-white/78 px-4 py-3">
|
||||||
|
<p class="text-[11px] font-bold tracking-[0.12em] text-stone-500">출력 예정</p>
|
||||||
|
<p class="mt-1 text-sm font-semibold text-stone-900">{{ printPageCountLabel }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-6 grid gap-2 sm:grid-cols-[1fr_auto]">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="rounded-full border border-stone-900 bg-stone-900 px-5 py-3 text-xs font-bold tracking-[0.16em] text-white transition hover:bg-stone-700"
|
||||||
|
@click="printPlannerRange"
|
||||||
|
>
|
||||||
|
PRINT
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="rounded-full border border-stone-300 bg-white px-5 py-3 text-xs font-bold tracking-[0.16em] text-stone-700 transition hover:border-stone-500 hover:text-stone-900"
|
||||||
|
@click="closePrintDialog"
|
||||||
|
>
|
||||||
|
취소
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="carryoverCheckPrompt"
|
v-if="carryoverCheckPrompt"
|
||||||
class="fixed inset-0 z-50 flex items-center justify-center bg-stone-900/45 px-4 py-6 backdrop-blur-sm"
|
class="fixed inset-0 z-50 flex items-center justify-center bg-stone-900/45 px-4 py-6 backdrop-blur-sm"
|
||||||
|
|||||||
@@ -35,6 +35,58 @@ function updateField(field, event) {
|
|||||||
value: event.target.type === 'checkbox' ? event.target.checked : event.target.value,
|
value: event.target.type === 'checkbox' ? event.target.checked : event.target.value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTitle(mode) {
|
||||||
|
if (mode === 'signup') {
|
||||||
|
return '회원가입'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode === 'reset-request') {
|
||||||
|
return '비밀번호 찾기'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode === 'reset-confirm') {
|
||||||
|
return '새 비밀번호 설정'
|
||||||
|
}
|
||||||
|
|
||||||
|
return '로그인'
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDescription(mode) {
|
||||||
|
if (mode === 'signup') {
|
||||||
|
return '기록을 저장할 계정을 만들어요.'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode === 'reset-request') {
|
||||||
|
return '가입한 이메일로 재설정 링크를 받을 수 있습니다.'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode === 'reset-confirm') {
|
||||||
|
return '메일로 받은 링크의 토큰과 새 비밀번호를 확인합니다.'
|
||||||
|
}
|
||||||
|
|
||||||
|
return '내 플래너를 이어서 열어요.'
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSubmitLabel(mode, busy) {
|
||||||
|
if (busy) {
|
||||||
|
return '처리 중...'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode === 'signup') {
|
||||||
|
return '가입하기'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode === 'reset-request') {
|
||||||
|
return '재설정 링크 받기'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode === 'reset-confirm') {
|
||||||
|
return '비밀번호 재설정'
|
||||||
|
}
|
||||||
|
|
||||||
|
return '로그인하기'
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -47,10 +99,10 @@ function updateField(field, event) {
|
|||||||
<div>
|
<div>
|
||||||
<p class="text-[10px] font-bold uppercase tracking-[0.24em] text-stone-500">10 Minute Planner</p>
|
<p class="text-[10px] font-bold uppercase tracking-[0.24em] text-stone-500">10 Minute Planner</p>
|
||||||
<h2 class="mt-2 text-2xl font-semibold tracking-[-0.04em] text-stone-900">
|
<h2 class="mt-2 text-2xl font-semibold tracking-[-0.04em] text-stone-900">
|
||||||
{{ mode === 'login' ? '로그인' : '회원가입' }}
|
{{ getTitle(mode) }}
|
||||||
</h2>
|
</h2>
|
||||||
<p class="mt-2 text-sm leading-6 text-stone-600">
|
<p class="mt-2 text-sm leading-6 text-stone-600">
|
||||||
{{ mode === 'login' ? '내 플래너를 이어서 열어요.' : '기록을 저장할 계정을 만들어요.' }}
|
{{ getDescription(mode) }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
@@ -74,7 +126,7 @@ function updateField(field, event) {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="space-y-2">
|
<div v-if="mode !== 'reset-confirm'" class="space-y-2">
|
||||||
<label class="text-[11px] font-bold tracking-[0.16em] text-stone-600">
|
<label class="text-[11px] font-bold tracking-[0.16em] text-stone-600">
|
||||||
{{ mode === 'login' ? '이메일 또는 아이디' : '이메일' }}
|
{{ mode === 'login' ? '이메일 또는 아이디' : '이메일' }}
|
||||||
</label>
|
</label>
|
||||||
@@ -87,7 +139,18 @@ function updateField(field, event) {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="space-y-2">
|
<div v-if="mode === 'reset-confirm'" class="space-y-2">
|
||||||
|
<label class="text-[11px] font-bold tracking-[0.16em] text-stone-600">재설정 토큰</label>
|
||||||
|
<input
|
||||||
|
:value="form.resetToken"
|
||||||
|
type="text"
|
||||||
|
class="w-full rounded-2xl border border-stone-300 bg-white/90 px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-500"
|
||||||
|
placeholder="메일 링크의 토큰"
|
||||||
|
@input="updateField('resetToken', $event)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="mode === 'login' || mode === 'signup'" class="space-y-2">
|
||||||
<label class="text-[11px] font-bold tracking-[0.16em] text-stone-600">비밀번호</label>
|
<label class="text-[11px] font-bold tracking-[0.16em] text-stone-600">비밀번호</label>
|
||||||
<input
|
<input
|
||||||
:value="form.password"
|
:value="form.password"
|
||||||
@@ -98,6 +161,17 @@ function updateField(field, event) {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="mode === 'reset-confirm'" class="space-y-2">
|
||||||
|
<label class="text-[11px] font-bold tracking-[0.16em] text-stone-600">새 비밀번호</label>
|
||||||
|
<input
|
||||||
|
:value="form.newPassword"
|
||||||
|
type="password"
|
||||||
|
class="w-full rounded-2xl border border-stone-300 bg-white/90 px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-500"
|
||||||
|
placeholder="8자 이상 입력해 주세요."
|
||||||
|
@input="updateField('newPassword', $event)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<label
|
<label
|
||||||
v-if="mode === 'login'"
|
v-if="mode === 'login'"
|
||||||
class="-mt-1 flex items-center gap-2 px-1 text-left"
|
class="-mt-1 flex items-center gap-2 px-1 text-left"
|
||||||
@@ -123,13 +197,22 @@ function updateField(field, event) {
|
|||||||
class="w-full rounded-full bg-stone-900 px-5 py-3 text-xs font-bold tracking-[0.18em] text-white transition hover:bg-stone-700 disabled:cursor-not-allowed disabled:bg-stone-400"
|
class="w-full rounded-full bg-stone-900 px-5 py-3 text-xs font-bold tracking-[0.18em] text-white transition hover:bg-stone-700 disabled:cursor-not-allowed disabled:bg-stone-400"
|
||||||
:disabled="busy"
|
:disabled="busy"
|
||||||
>
|
>
|
||||||
{{ busy ? '처리 중...' : mode === 'login' ? '로그인하기' : '가입하기' }}
|
{{ getSubmitLabel(mode, busy) }}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<button
|
||||||
|
v-if="mode === 'login'"
|
||||||
|
type="button"
|
||||||
|
class="mt-4 w-full text-center text-xs font-bold tracking-[0.14em] text-stone-500 underline underline-offset-4 transition hover:text-stone-900"
|
||||||
|
@click="emit('switch-mode', 'reset-request')"
|
||||||
|
>
|
||||||
|
비밀번호를 잊으셨나요?
|
||||||
|
</button>
|
||||||
|
|
||||||
<div class="mt-5 flex items-center justify-center gap-2 border-t border-stone-300/70 pt-4">
|
<div class="mt-5 flex items-center justify-center gap-2 border-t border-stone-300/70 pt-4">
|
||||||
<p class="text-sm font-semibold text-stone-600">
|
<p class="text-sm font-semibold text-stone-600">
|
||||||
{{ mode === 'login' ? '아직 계정이 없나요?' : '이미 계정이 있나요?' }}
|
{{ mode === 'signup' ? '이미 계정이 있나요?' : '계정 화면으로 돌아갈까요?' }}
|
||||||
</p>
|
</p>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ const props = defineProps({
|
|||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
accountDeleteForm: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
profileBusy: {
|
profileBusy: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
@@ -30,6 +34,14 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
accountDeleteBusy: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
accountDeleteMessage: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
guideTooltipResetMessage: {
|
guideTooltipResetMessage: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
@@ -45,6 +57,8 @@ const emit = defineEmits([
|
|||||||
'update:password-field',
|
'update:password-field',
|
||||||
'submit:profile',
|
'submit:profile',
|
||||||
'submit:password',
|
'submit:password',
|
||||||
|
'update:account-delete-field',
|
||||||
|
'submit:delete-account',
|
||||||
'reset-guide-tooltips',
|
'reset-guide-tooltips',
|
||||||
'update:carryover-check-policy',
|
'update:carryover-check-policy',
|
||||||
])
|
])
|
||||||
@@ -66,6 +80,13 @@ function updatePasswordField(field, event) {
|
|||||||
value: event.target.value,
|
value: event.target.value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateAccountDeleteField(field, event) {
|
||||||
|
emit('update:account-delete-field', {
|
||||||
|
field,
|
||||||
|
value: event.target.value,
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -219,6 +240,42 @@ function updatePasswordField(field, event) {
|
|||||||
{{ passwordBusy ? '변경 중...' : '비밀번호 변경' }}
|
{{ passwordBusy ? '변경 중...' : '비밀번호 변경' }}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<form
|
||||||
|
v-if="user.role !== 'admin'"
|
||||||
|
class="rounded-[28px] border border-rose-200 bg-white/75 p-6"
|
||||||
|
@submit.prevent="emit('submit:delete-account')"
|
||||||
|
>
|
||||||
|
<p class="text-[11px] font-bold uppercase tracking-[0.24em] text-rose-500">Delete Account</p>
|
||||||
|
<p class="mt-4 text-sm font-semibold leading-6 text-stone-700">
|
||||||
|
회원 탈퇴를 진행하면 플래너 기록, 목표, 계정 정보가 함께 삭제됩니다.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="mt-5 space-y-2">
|
||||||
|
<label class="text-[11px] font-bold tracking-[0.16em] text-stone-600">현재 비밀번호 확인</label>
|
||||||
|
<input
|
||||||
|
:value="accountDeleteForm.currentPassword"
|
||||||
|
type="password"
|
||||||
|
class="w-full rounded-2xl border border-rose-200 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-rose-400"
|
||||||
|
@input="updateAccountDeleteField('currentPassword', $event)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p
|
||||||
|
v-if="accountDeleteMessage"
|
||||||
|
class="mt-4 rounded-2xl border border-rose-200 bg-rose-50 px-4 py-3 text-sm font-semibold leading-6 text-rose-700"
|
||||||
|
>
|
||||||
|
{{ accountDeleteMessage }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="mt-5 rounded-full border border-rose-500 px-5 py-3 text-xs font-bold tracking-[0.18em] text-rose-600 transition hover:bg-rose-500 hover:text-white disabled:cursor-not-allowed disabled:border-rose-200 disabled:text-rose-300"
|
||||||
|
:disabled="accountDeleteBusy"
|
||||||
|
>
|
||||||
|
{{ accountDeleteBusy ? '처리 중...' : '회원 탈퇴' }}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -107,3 +107,32 @@ export async function updatePassword(token, { currentPassword, newPassword }) {
|
|||||||
body: { currentPassword, newPassword },
|
body: { currentPassword, newPassword },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function deleteAccount(token, { currentPassword }) {
|
||||||
|
return request('/api/auth/account', {
|
||||||
|
method: 'DELETE',
|
||||||
|
token,
|
||||||
|
body: { currentPassword },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function requestPasswordReset({ email }) {
|
||||||
|
return request('/api/auth/password-reset/request', {
|
||||||
|
method: 'POST',
|
||||||
|
body: { email },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function confirmPasswordReset({ token, newPassword }) {
|
||||||
|
return request('/api/auth/password-reset/confirm', {
|
||||||
|
method: 'POST',
|
||||||
|
body: { token, newPassword },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function confirmVerification({ token }) {
|
||||||
|
return request('/api/auth/verification/confirm', {
|
||||||
|
method: 'POST',
|
||||||
|
body: { token },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
background: #ffffff !important;
|
background: #ffffff !important;
|
||||||
width: auto !important;
|
width: auto !important;
|
||||||
height: auto !important;
|
height: auto !important;
|
||||||
overflow: hidden !important;
|
overflow: visible !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
@@ -50,17 +50,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.print-only {
|
.print-only {
|
||||||
display: flex !important;
|
display: block !important;
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
height: 100% !important;
|
height: auto !important;
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
break-inside: avoid-page;
|
|
||||||
page-break-inside: avoid;
|
|
||||||
break-after: avoid-page;
|
|
||||||
page-break-after: avoid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.print-root {
|
.print-root {
|
||||||
@@ -79,15 +73,24 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
background: #ffffff !important;
|
background: #ffffff !important;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
margin: 0 auto;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
break-after: page;
|
||||||
|
page-break-after: always;
|
||||||
|
break-inside: avoid-page;
|
||||||
|
page-break-inside: avoid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-paper:last-child {
|
||||||
|
break-after: avoid-page;
|
||||||
|
page-break-after: avoid;
|
||||||
}
|
}
|
||||||
|
|
||||||
body[data-print-layout='single'] .print-paper {
|
body[data-print-layout='single'] .print-paper {
|
||||||
width: 204mm;
|
width: 210mm;
|
||||||
height: 291mm;
|
height: 297mm;
|
||||||
align-items: flex-start;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding-top: 3mm;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.print-paper--double {
|
.print-paper--double {
|
||||||
@@ -99,8 +102,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
body[data-print-layout='double'] .print-paper {
|
body[data-print-layout='double'] .print-paper {
|
||||||
width: 285mm;
|
width: 297mm;
|
||||||
height: 196mm;
|
height: 210mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
body[data-print-layout='single'] .print-paper--single .print-sheet-frame {
|
body[data-print-layout='single'] .print-paper--single .print-sheet-frame {
|
||||||
@@ -116,6 +119,10 @@
|
|||||||
background: #ffffff !important;
|
background: #ffffff !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.print-sheet-frame--blank {
|
||||||
|
background: #ffffff !important;
|
||||||
|
}
|
||||||
|
|
||||||
body[data-print-layout='double'] .print-paper--double .print-sheet-frame {
|
body[data-print-layout='double'] .print-paper--double .print-sheet-frame {
|
||||||
width: 139mm;
|
width: 139mm;
|
||||||
height: 196mm;
|
height: 196mm;
|
||||||
|
|||||||
Reference in New Issue
Block a user