コード例 #1
0
ファイル: app.py プロジェクト: dlevylambert/project2-pd6
def login():
    if request.method=='GET':
        return render_template('login1.html')
    else:
        if request.form.has_key('login'):
            user = str(request.form['user'])
            password = str(request.form['pass'])
            if user in util.getUsernames():
                if password == util.checkPassword(user):
                    session['user'] = user
                    return redirect(url_for('calendar',year=int(util.thisYear()),month=util.thisMonth()))
            return render_template('login2.html')
        if request.form.has_key('newuser'):
            return redirect(url_for('newuser'))
コード例 #2
0
def login():
    if request.method == "GET":
        return render_template("login1.html")
    else:
        if request.form.has_key("login"):
            user = str(request.form["user"])
            password = str(request.form["pass"])
            if user in util.getUsernames():
                if password == util.checkPassword(user):
                    session["user"] = user
                    return redirect(url_for("calendar", year=int(util.thisYear()), month=util.thisMonth()))
            return render_template("login2.html")
        if request.form.has_key("newuser"):
            return redirect(url_for("newuser"))
コード例 #3
0
ファイル: app.py プロジェクト: dlevylambert/project2-pd6
def newuser():
    if request.method=='GET':
        return render_template('newuser.html',notmatching=False,taken=False)
    else: 
        if request.form.has_key('submit'):
            user = request.form['user']
            password1 = request.form['pass1']
            password2 = request.form['pass2']
            number = request.form['num']
            if user == '' or password1 == '':
                return render_template('newuser.html',notmatching=False,taken=False)
            if user in util.getUsernames():
                return render_template('newuser.html',notmatching=False,taken=True)
            if password1 != password2:
                return render_template('newuser.html',notmatching=True,taken=False)
            if util.createNewUser(user,password1,number):
                return redirect(url_for('login'))
            else: 
                return render_template('newuser.html',notmatching=False,taken=False)
        if request.form.has_key('back'):
            return redirect(url_for('login'))
コード例 #4
0
def newuser():
    if request.method == "GET":
        return render_template("newuser.html", notmatching=False, taken=False)
    else:
        if request.form.has_key("submit"):
            user = request.form["user"]
            password1 = request.form["pass1"]
            password2 = request.form["pass2"]
            number = request.form["num"]
            if user == "" or password1 == "":
                return render_template("newuser.html", notmatching=False, taken=False)
            if user in util.getUsernames():
                return render_template("newuser.html", notmatching=False, taken=True)
            if password1 != password2:
                return render_template("newuser.html", notmatching=True, taken=False)
            if util.createNewUser(user, password1, number):
                return redirect(url_for("login"))
            else:
                return render_template("newuser.html", notmatching=False, taken=False)
        if request.form.has_key("back"):
            return redirect(url_for("login"))