@bp.route('/signup', methods=['GET', 'POST'])
def signup():
 next_url = request.args.get('next', url_for('.setting'))
 token = request.args.get('token')
 if token:
  user = verify_auth_token(token, 1)
  if (not user):
   flash(_('Invalid or expired token.'), 'error')
   return redirect(next_url)
  user.role = 'user'
  user.save()
  login_user(user)
  flash(_('This account is verified.'), 'success')
  return redirect(next_url)
 form = SignupForm()
 if form.validate_on_submit():
  verify_email = current_app.config.get('VERIFY_EMAIL', True)
  if (not verify_email):
   user = form.save('user')
   login_user(user)
   return redirect(next_url)
  user = form.save()
  login_user(user)
  msg = signup_mail(user)
  if current_app.debug:
   return msg.html
  flash(_('We have sent you an activate email, check your inbox.'), 'info')
  return redirect(next_url)
 return render_template('account/signup.html', form=form)

@ bp . route ( '/signup' , methods = [ 'GET' , 'POST' ] ) def signup ( ) : next_url = request . args . get ( 'next' , url_for ( '.setting' ) ) token = request . args . get ( 'token' ) if token : user = verify_auth_token ( token , 1 ) if ( not user ) : flash ( _ ( 'Invalid or expired token.' ) , 'error' ) return redirect ( next_url ) user . role = 'user' user . save ( ) login_user ( user ) flash ( _ ( 'This account is verified.' ) , 'success' ) return redirect ( next_url ) form = SignupForm ( ) if form . validate_on_submit ( ) : verify_email = current_app . config . get ( 'VERIFY_EMAIL' , True ) if ( not verify_email ) : user = form . save ( 'user' ) login_user ( user ) return redirect ( next_url ) user = form . save ( ) login_user ( user ) msg = signup_mail ( user ) if current_app . debug : return msg . html flash ( _ ( 'We have sent you an activate email, check your inbox.' ) , 'info' ) return redirect ( next_url ) return render_template ( 'account/signup.html' , form = form )
signup form .