@auth.optional
def post(self):
    '\n    Handle the POST request and sign up the user if form validation passes\n\n    Returns:\n      A redirect or a template with the validation errors\n    '
    form = RegisterForm()
    if form.validate_on_submit():
        form.validate_username(form.username)
        avatar = 'no-image.png'
        if (('avatar' in request.files) and request.files['avatar']):
            avatar = avatar_service.save(form.avatar.data)
        User.create(form.username.data, form.password.data, avatar)
        flash('Your account has been created. You may now login.', 'info')
        return redirect(url_for('login'))
    return render_template('auth/register.html', form=form)
Handle the POST request and sign up the user if form validation passes

Returns:
  A redirect or a template with the validation errors
@auth.optional
def post(self):
    '\n    Handle the POST request and sign up the user if form validation passes\n\n    Returns:\n      A redirect or a template with the validation errors\n    '
    form = RegisterForm()
    if form.validate_on_submit():
        form.validate_username(form.username)
        avatar = 'no-image.png'
        if (('avatar' in request.files) and request.files['avatar']):
            avatar = avatar_service.save(form.avatar.data)
        User.create(form.username.data, form.password.data, avatar)
        flash('Your account has been created. You may now login.', 'info')
        return redirect(url_for('login'))
    return render_template('auth/register.html', form=form)