https://github.com/firstandthird/hapi-auth-email
hapi plugin for login with email/password
https://github.com/firstandthird/hapi-auth-email
hapi-plugin
Last synced: 9 months ago
JSON representation
hapi plugin for login with email/password
- Host: GitHub
- URL: https://github.com/firstandthird/hapi-auth-email
- Owner: firstandthird
- Created: 2015-06-19T23:37:13.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2017-04-26T23:34:39.000Z (almost 9 years ago)
- Last Synced: 2025-06-29T23:46:25.288Z (10 months ago)
- Topics: hapi-plugin
- Language: JavaScript
- Size: 50.8 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hapi Email Authentication
Usage:
```js
server.register({
register: require('hapi-auth-email'),
options: {}
}, function(err) {
// ...
server.auth.strategy('email', 'email', true);
});
```
Options:
- `schemeName` - Name to register and the auth scheme. Default: `'email'`
- `namespace` - Path to register server methods. Default: `'auth.'`
- `getAccount` - Method that returns a user account. Params: `request`, `callback(err, user)`. Returned user must contain the following properties: `email`, `hash`, `salt`
- `useDefaultViews` - Set to false to disable built in views. Default: `true`
- `redirectOnTry` - Redirect unauthenticated users when auth mode is `try`. Default: `true`
- `redirectTo` - Url to redirect user to. Default: `'/login'`
- `hashConfig` - Any valid https://github.com/davidmurdoch/easy-pbkdf2#options
The following addition options are only for built in views:
- `saveAccount` - Method to save the user. Only used when using the built in views. Params: `request`, `user`, `callback(err, user)`
- `loginPathTemplate` / `registerPathTemplate` / `resetPassPathTemplate` - Method to override view.
- `loginPath` - Login url for built in view. Default: `'/login'`
- `registerPath` - Registration url for built in view. Default: `'/register'`
- `resetPassPath` - Reset url for built in view. Default `'/reset'`
- `successEndpont` - Url to redirect to on successful login or registration when `?next` param doesn't exist. Default: `'/'`
- `cookieName` - Cookie name for built in views. Default: `'hapi-auth-email'`
- `cookieOptions` - Any valid Hapi cookie option.
- `loginForm` / `registerForm` / `resetForm`
- `name`: Name used on the form.
- `description`: Shown under name.
Methods:
These methods may be attached to a different namespace if `options.namespace` is set.
- `server.auth.generateHash` - Params: `user`, `password`, `callback(err, user)`
- `server.auth.validatePassword` - Params: `user`, `password`, `callback(err, isValid)`