qd
qd copied to clipboard
[Bug] 登录提示500错误
Verify steps
- [x] Tracker 我已经在 Issue Tracker 中找过我要提出的问题
- [x] Latest 我已经使用 最新源码 测试过,问题依旧存在
- [x] Core 这是 QD 框架存在的问题,并非我所使用的 QD 早期版本(如 20210628及之前版号 等)或模板的特定问题
- [x] Meaningful 我提交的不是无意义的 催促更新或修复 请求
QD Version
20250129
Bug on OS
Linux
Bug on Platform
Docker/Linux 64位
To Reproduce
登陆提示500: Internal Server Error
Describe the Bug
卸载容器重装后出现的,注册提示账号已存在,然后直接登录就提示500错误,登录和注册页面正常,就是无法进入主页
QD config
HTTPServerRequest(protocol='http', host='192.168.x.xxx:40022', method='POST', uri='/login', version='HTTP/1.1', remote_ip='172.x.x.x')
Traceback (most recent call last):
File "/usr/src/app/db/user.py", line 169, in decrypt
old = tmp = crypto.aes_decrypt(data, userkey)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/libs/mcrypto.py", line 82, in aes_decrypt
aes = AES.new(key, mode, iv)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/Crypto/Cipher/AES.py", line 228, in new
return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/Crypto/Cipher/__init__.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/Crypto/Cipher/_mode_cbc.py", line 274, in _create_cbc_cipher
cipher_state = factory._create_base_cipher(kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/Crypto/Cipher/AES.py", line 89, in _create_base_cipher
if len(key) not in key_size:
^^^^^^^^
TypeError: object of type 'int' has no len()
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/tornado/web.py", line 1790, in _execute
result = await result
^^^^^^^^^^^^
File "/usr/src/app/web/handlers/login.py", line 54, in post
if await self.db.user.challenge(email, password, sql_session=sql_session):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/db/user.py", line 114, in challenge
password_hash = await self.decrypt(user['id'], user['password'], sql_session=sql_session)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/db/user.py", line 178, in decrypt
raise self.UserDBException('decrypt error') from exc
db.user.User.UserDBException: decrypt error
QD log
无法进入系统,没有日志
Expected behavior
重装后应该是全新系统,但是仍然提示之前的账号已存在,确定删除镜像并重新拉取了。
Screenshots
No response
是不是数据目录里还用的原来的 database.db,如果 db 没换的话需要保证 AES_KEY 和 COOKIE_SECRET 和原来的配置一致