A
A
aial2016-10-26 08:53:55
Flask
aial, 2016-10-26 08:53:55

Authentication in Flask python?

Hello, I have such a question, I use flask python, When you log in, you must enter the profile. If I logged in later, then the server restarted, it does not remember that I already logged in. You need to re-enter your username and password. How to make him remember?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Cheremisin, 2016-10-26
@aial

If you use flask-login (flask-security seems to do this automatically), then there is a setting session.permanent = True
It should be used in app.before_request
Well, you can add a sign to the user whether to remember him on the site.
I have so:

@app.before_request
def make_session_permanent():
        g.user = current_user
        if g.user.store_me:
               session.permanent = True

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question