def create_account(): form = CreateAccountForm() if form.validate_on_submit(): formatted_email = format_email(form.email.data) hashed_salted_pw = bcrypt.hashpw(form.password.data.encode("utf-8"), bcrypt.gensalt()) if User.select().where(User.email == formatted_email).count() > 0: flash(f"Account with email {formatted_email} already exists") return redirect(url_for("login")) new_user = User.create( id=uuid.uuid4(), email=formatted_email, salted_pw=hashed_salted_pw, gender=form.gender.data, age_range=form.age_range.data, language=form.language.data, ) login_user(new_user) return redirect(url_for("home")) else: flash_errors(form) return render_template("create_account.html", form=form)
def user_youth(): form = CreateAccountForm() if form.validate_on_submit(): flash(f'Account created for {form.name.data}!', 'success') return redirect(url_for('home', _anchor='continue')) return render_template('user_youth.html', title='Create Youth Account', form=form)
def create_account(): """Creates user and renders template""" check_auth(1) form = CreateAccountForm() if form.validate_on_submit(): create_user_account(form.name.data, session['user_id']) flash('New account sucsefuly created!', 'success') return redirect(url_for('accounts')) return render_template('create_account.html', form=form)
def create_account_page(): account_form = CreateAccountForm() if account_form.validate_on_submit(): new_account ={ 'Name' : account_form.name.data, 'Email' : account_form.email.data, 'Address' : 'ABCDEFGHIJKLMNOP', 'Pass' : 'TEST' } # 這裡接create account的邏輯 new_account ['Address'],new_account ['Pass'] = client.generate_algorand_keypair() session['new_account'] = new_account flash('Create success') return redirect('/createaccount-finished') return render_template('/create/account.html', acco_form = account_form)