Committed by
GitHub
Update user.py
1,密码哈希:
将密码加盐哈希的逻辑抽取到 hash_password 函数中,提高代码复用性。
2,参数化查询:
使用参数化的 SQL 查询防止 SQL 注入攻击。
3表单字段获取:
使用 get 方法获取表单字段,并移除多余空格。
4,友好错误提示:
登录失败时,返回错误信息,并保留用户名以减少用户重新输入的负担。
Showing
1 changed file
with
28 additions
and
11 deletions
-
Please register or login to post a comment