S
S
Sergey Alekseev2018-02-20 17:58:26
Flask
Sergey Alekseev, 2018-02-20 17:58:26

Flask, how to store data in session?

Good evening, the algorithm of actions is as follows, the user enters, the data is added to the session and we can check which links to show him. The user has not logged in - REGISTRATION, LOGIN, if logged in, then a link to EXIT. It would be nice if we could check the data in any template. And is it possible to implement this through flask.session ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Tallmange, 2018-02-20
@serj2000

if session.get('authenticated', None) == None:
    # User is NOT authenticated
    # some code here

def authenticate():
    # check user's login and pass
    # ... then
    session['authenticated'] = True

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question