有人可以解釋一下
login_user (force = True)
使
force = True
?
我在互聯網上沒有找到太多關于它的資訊。
uj5u.com熱心網友回復:
api 檔案中有一點說明:
如果用戶處于非活動狀態,
True將其設定為無論如何都會登錄。默認為False.
uj5u.com熱心網友回復:
當被檔案弄糊涂時,如果經常有助于閱讀源代碼。查找源的技巧是知道搜索 Python 包索引 ( https://pypi.org/ ),并從包的頁面導航到其 github(或其他)存盤庫。在這里,一些挖掘將出現
https://github.com/maxcountryman/flask-login/blob/main/flask_login/utils.py#L146
這提供了額外的線索
Logs a user in. You should pass the actual user object to this. If the
user's `is_active` property is ``False``, they will not be logged in
unless `force` is ``True``.
穿過代碼所示勘探的位AnonymousUserMixin被使用LoginManager時,沒有人在被記錄,并且在這種情況下is_active將是False。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/316763.html
