2.3.13 • Published 9 years ago

@nxus/users v2.3.13

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

@nxus/users

Build Status

User management module for Nxus apps. Users provides a complete framework for managing users, authenticating routes and sessions.

Install

> npm install @nxus/users --save

Quickstart

Once Users is installed in your app, you are ready to go. It includes the following components:

  • user/team models
  • login/logout routes
  • authentication/session middleware

Models

Uses defines a set of common models you can use to build your application, using the @nxus/storage module (which uses Waterline to provide common ORM functionality).

User

Accessing the user model:

app.get('storage').getModel('user').then((User) => {
  ...
});

Fields

  • email: string
  • password: string
  • nameFirst: string
  • nameLast: string
  • position: string
  • enabled: boolean
  • admin: boolean
  • lastLogin: datetime
  • metadata: JSON
  • team: relation to Team model

Convenience Methods

  • name(): first + last name
  • isAdmin(): boolean if user is an Admin
  • validPassword(pass): returns true if the password is valid

Templates

Users defines a set of common templates you can use in your app

login

A login form preconfigured to work with the login/logout routes. Markup supports basic Bootstrap 3 CSS.

app.get('templater').render('users-login').then((content) => {
  ...
}

Routes

The Users module defines some convience routes for handling basic user functionality.

/login

Params Expects to recieve a POSTed form with the values username, password and redirect. redirect should be a url to redirect the user to on success. On login failure, the user will be redirected back to /login.

/logout

Params Expects to recieve a GET request with the param redirect, which is a url where the user will be redirected on successful logout.

API


Users

The Users Module provides a complete user authentication and authorization system.

2.3.13

9 years ago

2.3.11

9 years ago

2.3.10

9 years ago

2.3.9

9 years ago

2.4.0-6

9 years ago

2.4.0-5

9 years ago

2.4.0-4

9 years ago

2.4.0-3

9 years ago

2.4.0-2

9 years ago

2.4.0-1

9 years ago

2.4.0-0

9 years ago

2.3.8

9 years ago

2.3.7

9 years ago

2.3.6

9 years ago

2.3.5

9 years ago

2.3.4

9 years ago

2.3.3

9 years ago

2.3.2

9 years ago

2.3.1

9 years ago

2.3.0

9 years ago

2.2.7

9 years ago

2.2.6

9 years ago

2.2.5

9 years ago

2.2.4

9 years ago

2.2.3

10 years ago

2.2.2

10 years ago

2.2.1

10 years ago

2.2.0

10 years ago

2.1.0

10 years ago

2.0.0

10 years ago