feat: 회원가입 페이지 추가 + 카카오 전화번호 신청 문서
- /signup 회원가입 페이지 (이름 + 전화번호 + 개인정보 동의) - /api/signup API (get_or_create_user + 세션 저장) - 카카오 간편 가입 버튼 (카카오 로그인으로 가입) - 홈 화면에 회원가입 메뉴 추가 - 이미 로그인 시 /signup 접근하면 마이페이지로 리다이렉트 - 카카오 전화번호 수집 신청용 수집 사유 + 시나리오 문서 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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():
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user