示例#1
0
文件: users.py 项目: Davebreaux/Class
def login():
    data = {
        "email_address": request.form['login_email'],
    }
    if not EMAIL_REGEX.match(request.form['login_email']):
        flash("Invalid Email Address")
        return redirect('/')

    if not User.login_validate(data):
        return redirect('/')
    user = User.get_user(data)
    user = user[0]
    print(user)
    if not bcrypt.check_password_hash(user['pass_hash'],
                                      request.form['login_password']):
        flash('Username or Password is invalid')
        return redirect('/')

    session['email'] = user['email_address']
    session['first_name'] = user['first_name']
    return render_template('success.html')
示例#2
0
def edit_user_form(user_id ):
    data={
        "id":user_id
    }
       
    return render_template("edit_user.html", my_user= User.get_user(data))
示例#3
0
def user_info(user_id): 
    data={
        "id":user_id
    } 
    return render_template("user_info.html", my_user= User.get_user(data) )