title: Successful flask login returns route: /NONE
body: <p>This flask app is properly prompting for username and password- but according to the log files, returning the route /NONE despite that issue,  the session seems to be valid and other @login_required routes can be accessed.   Any ideas as to what is going on would be appreciated. </p>
  
  <p>Login Template: login.html</p>
  
  <pre><code>{% extends "bootstrap/base.html" %}
  {% block content %}
  &lt;div class="container"&gt;
  &lt;div class="row"&gt;
      &lt;form class="form-signin" action="/logmein" method="POST"&gt;
          &lt;h2 class="form-signin-heading"&gt; PCBevo Login&lt;/h2&gt;
          &lt;div class="col-2"&gt;
              &lt;label for="username" class="sr-only"&gt;Username&lt;/label&gt;
              &lt;input type="text" id="username" class="form-control" placeholder="username" name="username" required autofocus&gt;
          &lt;/div&gt;
          &lt;div class="col-3"&gt;
              &lt;label for="inputPassword" class="sr-only"&gt;Password&lt;/label&gt;
              &lt;input type="password" id="inputPassword" class="form-control" placeholder="password" name="password" required&gt;
          &lt;/div&gt;
          &lt;div class="col-4"&gt;
              &lt;button class="btn btn-lg btn-primary btn-block" type="submit" value="Submit"&gt;Sign in&lt;/button&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  
  &lt;/div&gt; &lt;!-- /container --&gt;
  {% endblock %}
  </code></pre>
  
  <p>Below is the SQLAlchemy User Model:</p>
  
  <pre><code>class User(UserMixin, db.Model):
      __tablename__ = "users"
      id = db.Column(db.Integer, primary_key=True)
      username = db.Column(db.String(254), unique=True)
      email = db.Column(db.String(50), unique=True)
      password = db.Column(db.String(80))
      groups = db.Column(db.String(80))
  
      def __init__(self, username, email, password, groups):
          self.username = username
          self.email = email
          self.password = password
          self.groups = groups if isinstance(groups, str) else      ','.join(groups)
  
      def __repr__(self):
          clsname = self.__class__.__name__
          return "{}({}) ".format(clsname, self.username)
  
      def is_developer(self):
  
          return isinstance(self.groups, str) and 'dev' in self.groups.split(',')
  </code></pre>
  
  <p>Selected attributes for app setup of login_manager and problem routes:</p>
  
  <pre><code>login_manager = LoginManager()
  login_manager.init_app(app)
  login_manager.login_view = 'login'
  
  @login_manager.user_loader
  def load_user(user_id):
      return User.query.get(int(user_id))
  
  @app.route('/login')
  def login():
      session['next'] = request.args.get('next')
      return render_template('login.html')
  
  @app.route('/logmein', methods=['POST'])
  def logmein():
      username = request.form['username']
      password = request.form['password']
      user = User.query.filter_by(username=username).first()
  
      if not user:
          return '&lt;h1&gt;User not found!&lt;/h1&gt;'
  
      stored_password = user.password
      if check_password_hash(stored_password, password):
         login_user(user)
          try:
              return redirect(session['next'])
          except KeyError:
              return '&lt;h1&gt;You are now logged in!&lt;/h1&gt;'
      else:
         return '&lt;h1&gt;Wrong password!&lt;/h1&gt;'
  </code></pre>