コード例 #1
0
ファイル: MainFile.py プロジェクト: WanjiruKaranja/Python
def register():
    if request.method == "POST":
        names = request.form["names"]
        email = request.form["email"]
        password = request.form["password"]
        password = generate_password_hash(password)
        User.create(names=names, email=email, password=password)
        flash("Account Created Successfully")
    return render_template("register.html")
コード例 #2
0
ファイル: app.py プロジェクト: John-Oula/DELAB
def signup():
    if request.method == "POST":
        names = request.form["name"]
        unames = request.form["username"]
        astyle = request.form["style"]
        email = request.form["email"]
        password = request.form["pwd"]
        password = generate_password_hash(password)
        User.create(names=names,
                    username=unames,
                    style=astyle,
                    email=email,
                    password=password)
        flash("Account Created Successfully")
    return render_template("SIGNUP.html")
コード例 #3
0
ファイル: app.py プロジェクト: John-Oula/DELAB
def profile():
    if not session.get('logged_in'):
        return redirect(url_for('login'))
    if request.method == "POST":
        names = request.form["names"]
        username = request.form["username"]
        email = request.form["email"]
        style = request.form["style"]
        users = User.select()
    return render_template('PROFILE.html')
コード例 #4
0
ファイル: MainFile.py プロジェクト: ForwardDaniel/Project
def login():
    if request.method == "POST":
        email = request.form["email"]
        password = request.form["password"]
        try:
            user = User.get(User.email == email)
            hashed_password = user.password
            if check_password_hash(hashed_password, password):
                flash("Logged in Successfully")
                session['logged_in'] = True
                session['names'] = user.names
                session['id'] = user.id
                return redirect(url_for('show'))
        except User.DoesNotExist:
            flash("Wrong Username or Password")
    return render_template("login.html")
コード例 #5
0
ファイル: app.py プロジェクト: John-Oula/DELAB
def login():
    if request.method == ['POST']:
        email = request.form["email"]
        password = request.form["pwd"]
        try:
            user = User.get(User.email == email)
            hashed_password = user.password
            if check_password_hash(hashed_password, password):
                flash("Logging in")
                session['logged_in'] = True
                session['names'] = user.names
                session['id'] = user.id
                return redirect(url_for('PROFILE'))
        except User.DoesNotExist:
            flash("Wrong Email/Username or password")
    return render_template('LOGIN.html')