@app.route('/')
@app.route('/login', methods=['GET', 'POST'])
def login():
    '''Serves the login page if not logged in, or the main menu if logged in'''
    if g.user is not None and g.user.is_authenticated:
        username = g.user.username
        return redirect(url_for('manage_data', username=username))

    form = LoginForm()
    if form.validate_on_submit():
        session['remember_me'] = form.remember_me.data
        if 'remember_me' in session:
            remember_me = session['remember_me']
            session.pop('remember_me', None)
        login_user(form.user, remember=remember_me)
        username = form.username.data
        return redirect(url_for('manage_data', username=username))
    return render_template('login.html', form=form)
dataset/ETHPy150Open daeilkim/refinery/refinery/refinery/webapp/admin.py/login/original