The RequireGuest Middleware


deploys to:  app/routing/middleware/auth/RequireGuest.middleware.js         exports:  RequireGuest

class RequireGuest

Middleware that, when applied, redirects the user to the login page if they are not authenticated.

test(express.request req, express.response res, function next)

returns:  undefined

Checks if req.session.auth.user exists, or req.session.auth.authenticated is true. If these are, that means that a user is logged in. If this check passes, then the errors/requires_guest view is rendered. Otherwise, the user is a guest (non-authenticated session), and the next function in the stack is called, allowing the request to continue.

Revision #2
Created Wed, Mar 6, 2019 8:14 PM by Garrett Mills
Updated Tue, Mar 19, 2019 5:28 PM by Garrett Mills