Take a look at the `example app <https://github.com/rochacbruno/flask_simplelogin/blob/master/example/app.py>`__.

And you can customize it in anyway you want and need, it receives a``form`` in context and it is a ``WTF form`` the submit should be doneto ``request.path`` which is the same ``/login`` view.

You can also use ``{% if is_logged_in %}`` in your template if needed.

Custom validators-----------------

Pass ``must`` argument to ``login_required`` decorator, it can be a``function`` or a list of ``functions`` if function returns ``None``means **No** error and validator passed. if function returns an``"Error message"`` means validator did not passed.

.. code:: python

def be_admin(username): """Validator to check if user has admin role""" user_data = my_users.get(username) if not user_data or 'admin' not in user_data.get('roles', []): return "User does not have admin role"