python - Masonite - TypeError > 使用 Auth 登录方法时没有字符串参数的编码
问题描述
登录时,我不断收到TypeError > encoding without a string argument
异常。我正在LoginController
使用 Masonite 随附的开箱即用的产品进行操作。
登录路线很好,但登录时不断抛出此异常。
这是代码片段:
def store(self, request: Request, auth: Auth):
if auth.login(request.input('email'), request.input('password')):
return request.redirect('/home')
return request.redirect('/login')
解决方案
这很可能是因为您的输入之一丢失。如果其中一个输入丢失,它将是有价值的None
,这将导致此异常。
检查 password 的值并确保它不是 type None
。
推荐阅读
- tensorflow - 在 GCP 上的 Ubuntu 16.04 实例上运行使用 tensorflow 的烧瓶应用程序,模型运行但预测与本地主机上的不同
- c++ - 为什么这个 C++ 程序没有显示任何输出?
- html - 移动设备上的用户输入和占位符文本对齐
- laravel - 指令名称 [] 无效。指令名称只能包含字母数字字符和下划线
- c# - 从 xml 继承/实现 List/ICollection/等反序列化类型
- python - 正权重和负权重
- powershell - 为什么 Powershell 的 Set-Content -Value 参数不能正确读取管道变量
- python-3.x - 如何让智能感知在 vscode 中工作,而 python 代码位于不同的模块中
- php - 无论如何在检查时设置推荐人喜欢隐藏?
- reactjs - 正确的键使用反应