auth-zanuro

1.0.14 • Public • Published

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:

  1. passwordFile: this option declares the file/path of the path were the credentials will be stored

  2. pathToProtect: this option declares the route/path to the content of the website that only the logged user can see.

  3. registerView: this option represents the view of the register form that can be accesed through the /register path.

  4. successRegisterView: this option represents the succesfully made register view that is rendered when the account is succesfully created.

  5. errorRegisterView: this option represents an error view that is rendered when an error ocurrs while creating the account.

  6. loginView: this option represents the view of the login form that can be accesed through the /login path.

  7. successLoginView: this option represents the succesfully made login view that is rendered when the login is succesfully made.

  8. errorLoginView: this option represents an error view that is rendered when an error ocurrs while loging into the account.

  9. logoutView: this option represents the view that the user will get once they log out of their account

  10. unauthorizedView: this option represents the view that the user will get if they access the content(/content path) without being logged in.

Readme

Keywords

none

Package Sidebar

Install

npm i auth-zanuro

Weekly Downloads

16

Version

1.0.14

License

ISC

Unpacked Size

9.32 kB

Total Files

3

Last publish

Collaborators

  • zanuro