From 2b3d8649ba15186ad6ea669379cb8b40ed32f5c0 Mon Sep 17 00:00:00 2001 From: thug0bin Date: Wed, 25 Feb 2026 09:34:41 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=B6=94=EA=B0=80=20+=20?= =?UTF-8?q?=EC=B9=B4=EC=B9=B4=EC=98=A4=20=EC=A0=84=ED=99=94=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EC=8B=A0=EC=B2=AD=20=EB=AC=B8=EC=84=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - /signup 회원가입 페이지 (이름 + 전화번호 + 개인정보 동의) - /api/signup API (get_or_create_user + 세션 저장) - 카카오 간편 가입 버튼 (카카오 로그인으로 가입) - 홈 화면에 회원가입 메뉴 추가 - 이미 로그인 시 /signup 접근하면 마이페이지로 리다이렉트 - 카카오 전화번호 수집 신청용 수집 사유 + 시나리오 문서 Co-Authored-By: Claude Opus 4.6 --- backend/app.py | 39 +++ backend/templates/index.html | 8 + backend/templates/signup.html | 482 ++++++++++++++++++++++++++++++++++ docs/kakao-phone-request.md | 79 ++++++ 4 files changed, 608 insertions(+) create mode 100644 backend/templates/signup.html create mode 100644 docs/kakao-phone-request.md diff --git a/backend/app.py b/backend/app.py index f9b5c27..7838416 100644 --- a/backend/app.py +++ b/backend/app.py @@ -535,6 +535,45 @@ def index(): ) +@app.route('/signup') +def signup(): + """회원가입 페이지""" + if 'logged_in_user_id' in session: + return redirect(f"/my-page?phone={session.get('logged_in_phone', '')}") + return render_template('signup.html') + + +@app.route('/api/signup', methods=['POST']) +def api_signup(): + """회원가입 API""" + try: + data = request.get_json() + name = data.get('name', '').strip() + phone = data.get('phone', '').strip().replace('-', '').replace(' ', '') + + if not name or not phone: + return jsonify({'success': False, 'message': '이름과 전화번호를 모두 입력해주세요.'}), 400 + + if len(phone) < 10: + return jsonify({'success': False, 'message': '올바른 전화번호를 입력해주세요.'}), 400 + + user_id, is_new = get_or_create_user(phone, name) + + # 세션에 유저 정보 저장 + session.permanent = True + session['logged_in_user_id'] = user_id + session['logged_in_phone'] = phone + session['logged_in_name'] = name + + return jsonify({ + 'success': True, + 'message': '가입이 완료되었습니다.' if is_new else '이미 가입된 회원입니다. 로그인되었습니다.', + 'is_new': is_new + }) + except Exception as e: + return jsonify({'success': False, 'message': f'오류가 발생했습니다: {str(e)}'}), 500 + + @app.route('/claim') def claim(): """ diff --git a/backend/templates/index.html b/backend/templates/index.html index 0e3e9c0..94e9d00 100644 --- a/backend/templates/index.html +++ b/backend/templates/index.html @@ -340,6 +340,14 @@ + + + + +