mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2025-12-14 08:06:23 +08:00
[Bug fix] block headers without app version
- Fix a bug that headers without `AppVersion` are allowed in client version checking.
This commit is contained in:
@@ -16,10 +16,9 @@ bp = Blueprint('auth', __name__, url_prefix='/auth')
|
||||
@arc_try
|
||||
def login():
|
||||
headers = request.headers
|
||||
if 'AppVersion' in headers: # 版本检查
|
||||
if Config.ALLOW_APPVERSION:
|
||||
if headers['AppVersion'] not in Config.ALLOW_APPVERSION:
|
||||
raise NoAccess('Wrong app version.', 1203)
|
||||
if Config.ALLOW_APPVERSION: # 版本检查
|
||||
if 'AppVersion' not in headers or headers['AppVersion'] not in Config.ALLOW_APPVERSION:
|
||||
raise NoAccess('Invalid app version.', 1203)
|
||||
|
||||
request.form['grant_type']
|
||||
with Connect() as c:
|
||||
@@ -45,10 +44,9 @@ def auth_required(request):
|
||||
|
||||
headers = request.headers
|
||||
|
||||
if 'AppVersion' in headers: # 版本检查
|
||||
if Config.ALLOW_APPVERSION:
|
||||
if headers['AppVersion'] not in Config.ALLOW_APPVERSION:
|
||||
return error_return(NoAccess('Wrong app version.', 1203))
|
||||
if Config.ALLOW_APPVERSION: # 版本检查
|
||||
if 'AppVersion' not in headers or headers['AppVersion'] not in Config.ALLOW_APPVERSION:
|
||||
return error_return(NoAccess('Invalid app version.', 1203))
|
||||
|
||||
with Connect() as c:
|
||||
try:
|
||||
|
||||
@@ -16,10 +16,10 @@ bp = Blueprint('user', __name__, url_prefix='/user')
|
||||
@bp.route('', methods=['POST']) # 注册接口
|
||||
@arc_try
|
||||
def register():
|
||||
if 'AppVersion' in request.headers: # 版本检查
|
||||
if Config.ALLOW_APPVERSION:
|
||||
if request.headers['AppVersion'] not in Config.ALLOW_APPVERSION:
|
||||
raise NoAccess('Wrong app version.', 1203)
|
||||
headers = request.headers
|
||||
if Config.ALLOW_APPVERSION: # 版本检查
|
||||
if 'AppVersion' not in headers or headers['AppVersion'] not in Config.ALLOW_APPVERSION:
|
||||
raise NoAccess('Invalid app version.', 1203)
|
||||
|
||||
with Connect() as c:
|
||||
new_user = UserRegister(c)
|
||||
|
||||
Reference in New Issue
Block a user