KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm working on a flask app that needs authentication. I've hooked up flask-login but it doesn't seem very graceful. First flask-login needs to make sure the user exists: @login_manager.user_loader def load_user(id): return User.query.get(id) But you also need to use 'login_user' to create the user object # Some code above user = User.query.filter_by(email = form.email.data, password = form.password.data).first() user.login_status = 1 db.session.commit() login_user(objects.SignedInUser(user.id, user.email, user.login_status == LoginStatus.Active)) # Some code below In the code above 'User' is a model for postgres and SignedInUser is just an object to be used for flask-login. Does anyone have an example of flask-login used with postgres?
Tags (comma-separated)
Save Edits
Cancel