Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import jsonify
- import app.controller as controller
- import app.models
- import config
- from app import *
- @app.route("/", methods=['GET'])
- def index():
- controller.home_page()
- return render_template('index.html', username="Dear Guest")
- @app.route("/signin", methods=['GET', 'POST'])
- def signin():
- error = None
- if request.method == 'POST':
- controller.check_login(request.form['username'],request.form['passwd'])
- return redirect(url_for('index'))
- elif request.method == 'GET':
- return render_template('signin.html')
- @app.route("/signout", methods=['POST'])
- def signout():
- session.pop('username', None)
- return render_template('signout.html')
- @app.route("/user", methods=['GET'])
- def user():
- return render_template('user.html', username=username)
- @app.route("/register", methods=['POST', 'GET'])
- def register():
- e = None
- if request.method == 'POST':
- controller.add_user(user_name = request.form['username'], password = request.form['passwd'])
- return render_template('user.html', username=request.form['username'])
- elif request.method == 'GET':
- return render_template('register.html')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement