Enable users to log in via a login form on the site at
If explicitly set to
/login route does not exist,
and it is not possible to log in via your username and password.
This usually makes sense only in the presence of an alternative such as
apostrophe-passport module, which adds support for login via
Google, Twitter, gitlab, etc.
Apostrophe's instance of the passport npm module. You may access this object if you need to implement additional passport "strategies."
loginAfterLogin is invoked on all modules that have one. This method
is a good place to set
req.redirect to the URL of your choice. If no module sets
req.redirect, the newly logged-in user is redirected to the home page.
is invoked with
req and may also optionally take a callback.
serializeUser method of
passport to serialize the
user by storing their user ID in the session.
deserializeUser method of
deserialize the user by locating the appropriate
user via the apostrophe-users
module. Then invokes the
loginDeserialize method of
every module that has one, passing the
user object. These
methods may optionally take a callback.
On every request, immediately after the user has been fetched,
user._permissions object which has a simple
boolean property for each permission the user possesses.
Permissions can be obtained either via the group or via the user object itself, although there is currently no interface for adding permissions directly to a user.
are populated accordingly.
If you have
admin- rights for any specific content types,
you are also granted
edit (create) permissions for other
types that are not restricted to admins only.
Adds the "local strategy" (username/email and password login)
to Passport. Users are found via the
find method of the
Users with the
disabled property set to true may not log in.
Passwords are verified via the
verifyPassword method of
apostrophe-users, which is
powered by the credential module.
Add Passport's initialize and session middleware.
Also add middleware to add the
Now works via the expressMiddleware property, allowing
control of timing relative to other modules.
/login route, both GET (show the form) and POST (submit the form).
Also add the
user property to
req.data when a user is logged in.
Push the login stylesheet.
Add the logout admin bar item.
Invoked by passport after an authentication strategy succeeds
and the user has been logged in. Invokes
any modules that have one and redirects to
if it is not set, to