From dac966e2d8e7a3701a4abdd67cc01d076981957b Mon Sep 17 00:00:00 2001 From: zzlgreat Date: Thu, 16 Oct 2025 07:01:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9/api/auth/register/phone?= =?UTF-8?q?=E4=B8=AD=E8=A6=81=E6=B1=82=E7=94=A8=E6=88=B7=E5=90=8D=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app.py b/app.py index 63211517..7ea0203d 100755 --- a/app.py +++ b/app.py @@ -2123,10 +2123,8 @@ def register_with_phone(): data = request.get_json() phone = data.get('phone') code = data.get('code') - password = data.get('password') - username = data.get('username') - if not all([phone, code, password, username]): + if not all([phone, code]): return jsonify({'success': False, 'error': '所有字段都是必填的'}), 400 # 验证验证码 @@ -2137,14 +2135,12 @@ def register_with_phone(): if stored_code['code'] != code: return jsonify({'success': False, 'error': '验证码错误'}), 400 - if User.query.filter_by(username=username).first(): - return jsonify({'success': False, 'error': '用户名已存在'}), 400 + if User.query.filter_by(phone=phone).first(): + return jsonify({'success': False, 'error': '手机号已存在'}), 400 try: # 创建用户 - user = User(username=username, phone=phone) - user.email = f"{username}@valuefrontier.temp" - user.set_password(password) + user = User(username='用户', phone=phone) user.phone_confirmed = True db.session.add(user)