Allow login_user() to load the user from the database
This makes it easier to properly log someone in from a unit test.
This commit is contained in:
parent
2703617179
commit
fdb9154b85
@ -79,10 +79,13 @@ def config_login_manager(app):
|
|||||||
return login_manager
|
return login_manager
|
||||||
|
|
||||||
|
|
||||||
def login_user(oauth_token):
|
def login_user(oauth_token, *, load_from_db=False):
|
||||||
"""Log in the user identified by the given token."""
|
"""Log in the user identified by the given token."""
|
||||||
|
|
||||||
user = UserClass(oauth_token)
|
if load_from_db:
|
||||||
|
user = _load_user(oauth_token)
|
||||||
|
else:
|
||||||
|
user = UserClass(oauth_token)
|
||||||
flask_login.login_user(user)
|
flask_login.login_user(user)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user