In your login handler, simply check if the user is logged in early in the function. For example, if you're using Flask-Login:
def login():
if current_user.is_authenticated():
return redirect(url_for('index'))
# process login for anon user