Compare commits
10 Commits
4e71623477
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95f20e3049 | ||
|
|
7cca5e73c0 | ||
|
|
f9ed6c19de | ||
|
|
112fbbd42d | ||
| d4f813d58e | |||
| 05063374c0 | |||
| dac966e2d8 | |||
|
|
3a4dade8ec | ||
|
|
6f81259f8c | ||
|
|
864844a52b |
25
app.py
25
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)
|
||||
@@ -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'])
|
||||
|
||||
Reference in New Issue
Block a user