def login_user(): if request.method == 'GET': user = User.get_by_email(session['email']) return render_template("profile.html", name=User.get_name(user.email), email=session['email']) email = request.form['email'] password = request.form['password'] if User.login_valid(email, password): User.login(email) else: session['email'] = None return render_template('login.html') return render_template("profile.html", name=User.get_name(email), email=session['email'])
def user_books(user_id=None): if user_id is not None: user = User.get_by_id(user_id) else: user = User.get_by_email(session['email']) books = user.get_books() return render_template("user_books.html", books=books, name=User.get_name(user.email), email=user.email)