nloginweb-js

1.0.0 • Public • Published

nlogin-webjs

nLogin plugin integrated with your project!

Note: This is a fork of(original package) but more updated with some improvements and password hashing added...

🎇 Include library

You need to do the import, you can do it like this:

const  nLogin  =  require('nlogin')

Now we need to create a new instance for the database to connect to.

const  nloginInstance  =  new  nLogin("host without port", "dbusername", "dbpassword", "dbname",  (err)=>{
	console.log(err  ==  null?  "Connected!"  :  "Error connecting!")
	...
})

Available Methods 🔍

👦 User Authentication:

nloginInstance.checkPassword("username","password",  (isCorrectPass)=>{
	console.log(isCorrectPass?"Access granted!":"Access denied!")

	...
})

🎫 Register a Player:

nloginInstance.register("username","password","email","ip",  null/*this is the callback but is optional, it just tells if it was successful*/)

Check If Player Is Registered:

nloginInstance.isUserRegistered("username",  (isRegistered)=>{
	console.log(isRegistered?"Registered":"Not registered")
	...
})

Check if a IP Is Registered:

nloginInstance.isIpRegistered("ad.dr.es.s",  (isRegistered)=>{
	console.log(isRegistered?"Registered":"Not registered")
	...
})

🔏 Change a Player's Password:

nloginInstance.changePassword("newPassword",  "XtiagodinisX", callback /*Optional*/)

Note: The code will be refactored and organized as I see fit, so that little by little the project becomes independent and no longer a fork.

Package Sidebar

Install

npm i nloginweb-js

Weekly Downloads

3

Version

1.0.0

License

GPL-3.0

Unpacked Size

49.1 kB

Total Files

5

Last publish

Collaborators

  • lincolnjota