Compare commits

...

5 Commits

Author SHA1 Message Date
zdl
95f20e3049 Merge branch 'develop' 2025-10-21 11:02:16 +08:00
zdl
f9ed6c19de Merge branch 'develop'
# Conflicts:
#	app.py
2025-10-17 15:07:34 +08:00
d4f813d58e api/auth/wechat/qrcode接口外包裹 2025-10-16 07:05:13 +08:00
05063374c0 Merge branch 'main' of https://git.valuefrontier.cn/vf/vf_react
修改/api/auth/register/phone
2025-10-16 07:01:45 +08:00
dac966e2d8 修改/api/auth/register/phone中要求用户名密码的逻辑 2025-10-16 07:01:25 +08:00

25
app.py
View File

@@ -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)
@@ -2510,13 +2506,12 @@ def get_wechat_qrcode():
'wechat_unionid': None
}
return jsonify({"code":0,
"data":
{
'auth_url': wechat_auth_url,
'session_id': state,
'expires_in': 300
}}), 200
return jsonify({'code':0,
'data':{
'auth_url': wechat_auth_url,
'session_id': state,
'expires_in': 300
}}), 200
@app.route('/api/account/wechat/qrcode', methods=['GET'])