text: #!/usr/local/bin/python3.6
  # -*- coding: utf-8 -*-
  
  __author__ = 'Alen Mistric <anigma@purehype.no>'
  __copyright__ = 'Copyright 2017 Alen Mistric'
  __license__ = 'ISC'
  
  from flask import Flask, render_template, request
  from flask_wtf import FlaskForm
  from wtforms import StringField, SubmitField
  from wtforms.validators import InputRequired, Email
  
  class WhitelistForm(FlaskForm):
      email = StringField('Email address', validators=[Email(), InputRequired()])
      domain = StringField('Domain name', validators=[InputRequired()])
      submit = SubmitField('Go')
  
      #def validate_domain(form, field):
          # if something:
              # do something
  
  app = Flask(__name__)
  app.config['SECRET_KEY'] = 'foobar'
  app.debug = True
  
  @app.route('/', methods=['GET', 'POST'])
  def index():
      form = WhitelistForm()
  
      if form.validate_on_submit():
          email = request.form['email']
          domain = request.form['domain']
          return 'Your email address is {0} \
                  and your domain name is {1}'.format(email, domain)
      
      return render_template('index.html', form=form)
  
  @app.errorhandler(404)
  def not_found(error):
      return render_template('error.html'), 404
  
  if __name__ == '__main__':
      # For debugging purposes only
      app.env = 'development'
      app.run(host='127.0.0.1', port=5000)
  