1.2.2 • Published 4 years ago

@wrserver/auth v1.2.2

Weekly downloads
-
License
-
Repository
github
Last release
4 years ago

WRServer/Auth

License Email Donate Donate

@wrserver auth module to manage user login/logout/registration/validation/settings

Installing

Install this library is easy by cloning the repo. You can install trhought npm too:

Local installation

npm install @wrserver/auth

Global installation

npm install -g @wrserver/auth

We recomend to use the entire base package (core, crypt, data, auth, mail)

AuthController

This module add the AuthController to the WRServer Set of elements. It provides a list of pages usefull to manage accounts server-side. Pages are: login, logout, register, verify, password (change), email (change). It depends ond DataModel and automatically use the DataService to manage a json table for user anagrafic storage.

Use AuthModule

At Server definition (settings)

import { WRServer }from '@wrserver/core';
import { AuthModule } from '@wrserver/auth';

//REMEMBER: don't use this static methods inside module definitions
AuthModule.withEncrypt(true|false).withMailHost(<hosts: [gmail.com, yahoo.com, ...]>)
            .withService(<mail service: gmail>).withUser(<username>).withPass(<password>)
            .withRegistrationMail(<AuthRegistrationMail>)
//Server definition
let server: WRServer = new WRServer(<dir>, <port>, [ AuthModule, ... Other Modules ... ], ...)

Use AuthController

From your client send message for:

Login Page

{ 
    "target": "auth",
    "section": "auth",
    "page": "login",
    "data": { "name": <name>, "password": <password> }
}

Logout Page - After logged in

{ 
    "target": "auth",
    "section": "auth",
    "page": "logout"
}

Register Page

{ 
    "target": "auth",
    "section": "auth",
    "page": "register",
    "data": { "name": <name>, "password": <password>, "email": <email> }
}

Verify Page

{ 
    "target": "auth",
    "section": "auth",
    "page": "verify",
    "data": { "name": <name>, "token": <registrationToken> }
}

Password (change) Page - After logged in

{ 
    "target": "auth",
    "section": "auth",
    "page": "password",
    "data": <newPass>
}

Email (change) Page - After logged in

{ 
    "target": "auth",
    "section": "auth",
    "page": "email",
    "data": <newEmail>
}

Contacts

If you like the project feel free to contact me on my Email.

Something gone wrong? Feel free to rise an issue!

Did you like this project and it was usefull? Help me improve my work:

Donate Donate

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago