title: Temporarily Override Login Message from Specific Redirected Route with Flask-Login
body: <p>I have a Flask app and am using Flask-Login to manage user authentication. The main route ('/') requires login, however I would not like it to flash the error message defined for this specific route. I would like it to behave as it should flashing the error messages for other routes but not this one. Here is a snippet from my <strong>init</strong>.py</p>
  
  <pre><code>login_manager = LoginManager()
  login_manager.init_app(app)
  login_manager.login_view =  'login'
  login_manager.login_message = 'You Must Login to Access This Page!'
  login_manager.login_message_category = 'error'
  </code></pre>
  
  <p>The following is from my views.py</p>
  
  <pre><code>@app.route('/')
  @login_required
  def dashboard():
      return render_template('dashboard.html')
  
  @app.route('/login', methods=["GET", "POST"])
  def login():
      form = LoginForm()
      if form.validate_on_submit():
          user = Employee.query.filter_by(email=form.email.data).first()
          if user and user.is_valid_pass(form.password.data):
              remember = form.remember.data == 'y'
              login_user(user, remember=remember)
              next = request.args.get('next')
              return redirect(next or url_for('dashboard'))
          else:
              flash(u'Incorrect Username or Password!', 'error')
              return redirect(url_for('login'))
      return render_template('login.html', form=form)
  </code></pre>
  
  <p>As you can see I have the main route password protected, and because of the login_manager settings it is flashing the message "You Must Login to Access This Page!" and of course I'm displaying those errors on the login template. However, how can I ensure that this functions accordingly for every route EXCEPT the main ('/') route? I've been through the documentation but I see nothing that would indicate it could be done.</p>
  
  <p>Can I simply overwrite the login_manager.login_message with None in that specific route? If so, how would the login manager be appropriately called, overwritten, and then changed back?</p>