auth-zanuro v1.0.14
Auth-Zanuro(alu0100968590)
This module was made to implement an authorization type middleware that would let you navigate through different paths. Therefore exports a function that returns an middleware used for that purpose.
Basic functioning
This module defines the following: 1. Route for accesing the content of the page through the /content path using the GET method, only when the user is logged in the current session 2. Route for login into the website through the /login route using the GET/POST method, to be able to visualize the content of the page you need to be logged in 3. Route for registering into the website through the /register route using the GET/POST method, to be able to login into the website you need a valid account.
Options
The function that exports the module needs an data type object,this object having the following attributes:
passwordFile
: this option declares the file/path of the path were the credentials will be storedpathToProtect
: this option declares the route/path to the content of the website that only the logged user can see.registerView
: this option represents the view of the register form that can be accesed through the /register path.successRegisterView
: this option represents the succesfully made register view that is rendered when the account is succesfully created.errorRegisterView
: this option represents an error view that is rendered when an error ocurrs while creating the account.loginView
: this option represents the view of the login form that can be accesed through the /login path.successLoginView
: this option represents the succesfully made login view that is rendered when the login is succesfully made.errorLoginView
: this option represents an error view that is rendered when an error ocurrs while loging into the account.logoutView
: this option represents the view that the user will get once they log out of their accountunauthorizedView
: this option represents the view that the user will get if they access the content(/content path) without being logged in.