Пример #1
0
def create_user():
    password_hash = bcrypt.generate_password_hash(
        user_data["password"]
    ).decode('utf-8')
    user = User(username=user_data["username"], password=password_hash)
    db.session.add(user)
    db.session.commit()
Пример #2
0
def signup():
    signUpForm = SignUpForm
    if request.method == 'POST' and signUpForm.validate_on_submit():
        new_user = User(username=signUpForm.username,
                        password=bcrypt.generate_password_hash(
                            signUpForm.password))
        db.session.add(new_user)
        db.session.commit()
        login_user(new_user)
        return redirect('main.homepage')
    return render_template('signup.html', signUpForm=signUpForm)
Пример #3
0
def signup():
    form = SignUpForm()
    if form.validate_on_submit():
        hashed_password = bcrypt.generate_password_hash(
            form.password.data).decode('utf-8')
        user = User(username=form.username.data, password=hashed_password)
        db.session.add(user)
        db.session.commit()
        flash('Account Created.')
        return redirect(url_for('auth.login'))
    return render_template('signup.html', form=form)
def create_user():
    password_hash = bcrypt.generate_password_hash('password').decode('utf-8')
    user = User(username='******', password=password_hash)
    db.session.add(user)
    db.session.commit()
Пример #5
0
def create_user():
    """Creates a user with username 'me1' and password of 'password' """
    password_hash = bcrypt.generate_password_hash('password').decode('utf-8')
    user = User(username='******', password=password_hash)
    db.session.add(user)
    db.session.commit()