Exemplo n.º 1
0
def checklogin(name = None):
    if name != None and request.args.get('login') == None:
        return render_template('checklogin.html', name = name)
    else:
        if a.checkIfConnected(request.args.get('login')) == True and name == request.args.get('login'):
            session['logged_in'] = True
            session['user_login'] = request.args.get('login')
            connection = a.getUserConnectionData(session['user_login'])
            session['author_id'] = connection['author_id']
            session['session_id'] = connection['session_id']
            return "OK"
        else:
            return "KO"
Exemplo n.º 2
0
 def decorated_function(*args, **kwargs):
     if 'logged_in' not in  session or a.checkIfConnected(session['user_login']) == False:
         session.pop('logged_in', None)
         return redirect(url_for('login'))
     return f(*args, **kwargs)