Exemple #1
0
def load_anonymous_user():
    """ Factory method for anonymous users which stores a user ID in
        the session. This is assigned to `login_manager.anonymous_user`
        in main.py.
    """
    if 'anon_id' in session:
        au = AnonymousUser(session['anon_id'])
    else:
        aid = ''.join(random.choice(string.ascii_lowercase + string.digits)
                      for _ in range(8))
        session['anon_id'] = aid
        au = AnonymousUser(aid)

    set_user_id(au.get_id())
    return au
Exemple #2
0
def load_anonymous_user():
    """ Factory method for anonymous users which stores a user ID in
        the session. This is assigned to `login_manager.anonymous_user`
        in main.py.
    """
    if 'anon_id' in session:
        au = AnonymousUser(session['anon_id'])
    else:
        aid = ''.join(random.choice(string.ascii_lowercase + string.digits)
                      for _ in range(8))
        session['anon_id'] = aid
        au = AnonymousUser(aid)

    set_user_id(au.get_id())
    return au
Exemple #3
0
 def load_user(userid):
     user = User.query.filter_by(id=userid).first()
     if user:
         set_user_id(user.email)
     return user
Exemple #4
0
 def load_user(userid):
     user = User.query.filter_by(id=userid).first()
     if user:
         set_user_id(user.email)
     return user