Ejemplo n.º 1
0
def login():
    lesson1 = Lesson.get_by_lesson_id('3845127e-e6d9-4a15-b6e0-14276ace1cd8')
    lesson2 = Lesson.get_by_lesson_id('618af7ad-3d63-4609-a7f1-50704106b9e4')

    if 'name' in session:
        return render_template("home.html",
                               name=session['name'],
                               lesson1=lesson1,
                               lesson2=lesson2,
                               status="home")
    else:
        return render_template("login.html", status="login")
Ejemplo n.º 2
0
def login_user():
    error = None
    name = request.form['name']
    password = request.form['password_hash']
    lesson1 = Lesson.get_by_lesson_id('3845127e-e6d9-4a15-b6e0-14276ace1cd8')
    lesson2 = Lesson.get_by_lesson_id('618af7ad-3d63-4609-a7f1-50704106b9e4')

    if User.login_valid(name, password):
        return render_template('home.html',
                               name=session['name'],
                               lesson1=lesson1,
                               lesson2=lesson2,
                               status="home")
    else:
        error = 'Invalid credentials'
        session['name'] = None
        return render_template('login.html', error=error, status="login")