Exemple #1
0
 def _persistUser(self, email, password):
     acct = Account()
     acct.email = email
     acct.password = password
     Session = sessionmaker(bind=engine)
     session = Session()
     session.add(acct)
     session.commit()
     print("persisted default user with email", email, " and id ", acct.id)
Exemple #2
0
def save_user(user):
    o = Account()
    o.f_name = str(user['first_name'])
    o.l_name = str(user['last_name'])
    o.user_id = str(user['username'])
    o.email_address = str(user['email_address'])
    o.secret = str(user['secret'])
    o.otp_salt = str(user['otp_salt'])
    o.passwd_salt = str(crypto.gen_salt())
    o.password = crypto.secure_pw(str(user['password']),o.passwd_salt,fast=True)
    o.save()
    return o
Exemple #3
0
def save_user(user):
    o = Account()
    o.f_name = str(user['first_name'])
    o.l_name = str(user['last_name'])
    o.user_id = str(user['username'])
    o.email_address = str(user['email_address'])
    o.secret = str(user['secret'])
    o.otp_salt = str(user['otp_salt'])
    o.passwd_salt = str(crypto.gen_salt())
    o.password = crypto.secure_pw(str(user['password']),
                                  o.passwd_salt,
                                  fast=True)
    o.save()
    return o
Exemple #4
0
def signup():
    if(current_user.is_authenticated and current_user.is_active):
        return redirect(url_for('main.home'))

    form = AccountForm(request.form)

    if form.validate_on_submit():
        account = Account()
        form.populate_obj(account)

        account.password = password_encrypt(account.password)

        account.save()

        if login_user(account) and account.is_active():
            account.update_activity_tracking(request.remote_addr)
            return redirect(url_for('main.home'))

    return render_template('/pages/signup.html', form=form)