Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

nodebb-plugin-ns-login2

NicolasSiver5MIT3.0.0

External login check for your NodeBB. Provides API endpoint for user login.

nodebb, plugin, login, secure, check, simple

readme

NodeBB: Simple Login

Simple API endpoint for external login. Special use case: external login check if user's credentials are valid.

Version

API

Plugin adds additional API endpoint.

[POST] https://YourBoardDomain.com/api/ns/login

Properties:

  • username [String] - Required field. It could be username or email. It uses internal NodeBB methods to resolve.
  • password [String] - Required field.

Result:

Successful login returns user data, it looks like:

{
"_key": "user:1",
"username": "Nicolas",
"userslug": "nicolas",
"email": "nicolas@email.com",
"email:confirmed": 1,
"joindate": 1432379229517,
"picture": "https://secure.gravatar.com/avatar/16e774e25b68ab1d41d2cc269a29983a?size=128&default=identicon&rating=pg",
"gravatarpicture": "https://secure.gravatar.com/avatar/16e774e25b68ab1d41d2cc269a29983a?size=128&default=identicon&rating=pg",
"fullname": "",
"location": "",
"birthday": "",
"website": "",
"signature": "",
"uploadedpicture": "",
"profileviews": 0,
"reputation": 0,
"postcount": 0,
"topiccount": 0,
"lastposttime": 0,
"banned": 0,
"status": "online",
"uid": 1,
"passwordExpiry": 0,
"lastonline": 1432379559871
}

Using plugin as internal REST API

Whenever used as internal API disable IP limiter in userDefence instance of express-brute.

userDefence.getMiddleware({
    // Disregard IP address when matching requests if set to true
    // Set true if API is used internaly from few IPs
    ignoreIP: true, 
    key: function (req, res, next) {
        // prevent too many attempts for the same username
        next(req.body.username);
    }
})

Additional information

  • It is simple
  • It has brute-force defence. The brute-force counter resets on successful login.

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

[3.0.0] - 2019-01-13

  • Changed compatibility with NodeBB ver. 1.11.x

[2.3.0] - 2017-11-05

  • Added reset for the successful login

[2.2.0] - 2017-03-20

  • Added email support as a login credential

[2.1.0] - 2017-02-26

  • Added email:confirmed field

[2.0.2] - 2016-04-07

  • Changed library dependencies

[2.0.1] - 2016-04-07

  • Added compatibility with 1.0 NodeBB

[2.0.0] - 2015-11-29

  • Added compatibility with 0.9 NodeBB

[1.0.0] - 2015-05-23

  • Initial release