# nodebb-plugin-ns-login-modify

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

Latest version **3.0.2** (published 2023-02-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install nodebb-plugin-ns-login-modify
pnpm add nodebb-plugin-ns-login-modify
yarn add nodebb-plugin-ns-login-modify
bun add nodebb-plugin-ns-login-modify
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2023-02-26 |
| First published | 2023-02-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 12.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 21 |
| Author | Nicolas Siver |
| Maintainers | small_miao |
| Keywords | nodebb, plugin, login, secure, check, simple |

## Links

- npm: https://www.npmjs.com/package/nodebb-plugin-ns-login-modify
- Repository: https://github.com/NicolasSiver/nodebb-plugin-ns-login
- Homepage: https://github.com/NicolasSiver/nodebb-plugin-ns-login#readme
- Issues: https://github.com/NicolasSiver/nodebb-plugin-ns-login/issues
- npm.io page: https://npm.io/package/nodebb-plugin-ns-login-modify

## Dependencies (3)

- [async](https://npm.io/package/async.md) ^2.1.5
- [moment](https://npm.io/package/moment.md) ^2.18.0
- [express-brute](https://npm.io/package/express-brute.md) ^1.0.1

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 3.0.2 (latest) — 2023-02-26
- 3.0.1 — 2023-02-26
- 3.0.0 — 2023-02-26

## README

# NodeBB: Simple Login

Simple API endpoint for external login. Special use case: external login check if user's credentials are valid.

![Version](https://img.shields.io/npm/v/nodebb-plugin-ns-login.svg)

## 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:

```js
{
"_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.

---
_Source: https://npm.io/package/nodebb-plugin-ns-login-modify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
