[Bug Fix][Enhance] PTT update lately & Register rate limiter

- Fix a bug that PTT updates delay to next play.
- Add the IP and the device rate limiters for user register.
This commit is contained in:
Lost-MSth
2024-09-28 14:59:24 +08:00
parent dc1ca344e5
commit 9c9af892bd
6 changed files with 35 additions and 7 deletions

View File

@@ -32,12 +32,12 @@ def register():
else:
device_id = 'low_version'
new_user.register()
ip = request.remote_addr
new_user.register(device_id, ip)
# 注册后自动登录
user = UserLogin(c)
user.login(new_user.name, new_user.password,
device_id, request.remote_addr)
user.login(new_user.name, new_user.password, device_id, ip)
current_app.logger.info(f'New user `{user.user_id}` registered')
return success_return({'user_id': user.user_id, 'access_token': user.token})