Example #1
0
def login():
    err = "Incorrect username or password"
    if request.method == "POST":
        uname = request.form['username']
        pword = request.form['password']
        if utils.authenticate(uname, pword) == 1:
            utils.sess = utils.genToken();
            session['token'] = utils.sess;
            utils.logtime = time.gmtime()
            return redirect(url_for('calendar'))
        else:
            return render_template("login.html", err=err)
    return render_template("login.html")
Example #2
0
def register():
    err = "Username already taken"
    if request.method == "POST":
        uname = request.form['username']
        pword = request.form['password']
        if utils.newUser(uname, pword) == 1:
            utils.sess = utils.genToken();
            session['token'] = utils.sess;
            utils.logtime = time.gmtime()
            return redirect(url_for('calendar'))
        else:
            return render_template("register.html", err=err)
    return render_template("register.html")