示例#1
0
    def post(self):
        form = RegisterForm()
        
        if form.validate_on_submit():
            user = User(account=form.account.data,
                        password=bcrypt.generate_password_hash(form.password.data).decode(),
                        name=form.name.data,
                        store_name=form.name.data,
                        email=form.email.data,
                        phone=form.phone.data,
                        birth=form.birth.data,
                        address='',
                        prefer_begin_time='',
                        prefer_end_time='')
            
            user.save()

            information = Information(user_id = user.id)
            information.save()

            send_mail("HiShop帳號認證", [form.email.data], url_for("verification", _external=True, user_id=user.id))

            return redirect(url_for('login'))
        
        return render_template('auth/register.html', form=form)
示例#2
0
    def post(self):
        form = RegisterForm()

        if form.validate_on_submit():
            user = User(account=form.account.data,
                        password=bcrypt.generate_password_hash(
                            form.password.data).decode(),
                        name=form.name.data,
                        store_name=form.name.data,
                        email=form.email.data,
                        phone=form.phone.data,
                        birth=form.birth.data)
            user.save()

            information = Information(user_id=user.id)
            information.save()
            login_user(user)
            return redirect(url_for('user.profile'))

        return render_template('auth/register.html', form=form)