# hapi-login-example

> Example of building a registration flow using hapi-register plugin for Hapi.js

Latest version **1.0.13** (published 2016-03-02) · GPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install hapi-login-example
pnpm add hapi-login-example
yarn add hapi-login-example
bun add hapi-login-example
```

## 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 | 1.0.13 |
| Published | 2016-03-02 |
| First published | 2015-11-08 |
| Weekly downloads | 0 |
| License | GPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 11 |
| Known vulnerabilities | 0 (+7 in 4 direct dependencies) |
| Install scripts | no |
| GitHub stars | 14 |
| Author | nelsonic & friends |
| Maintainers | nelsonic |
| Keywords | hapi, registration, plugin, example |

## Links

- npm: https://www.npmjs.com/package/hapi-login-example
- Repository: https://github.com/dwyl/hapi-login-example
- Homepage: https://github.com/dwyl/hapi-login-example#readme
- Issues: https://github.com/dwyl/hapi-login-example/issues
- npm.io page: https://npm.io/package/hapi-login-example

## Dependencies (11)

- [joi](https://npm.io/package/joi.md) ^8.0.4
- [boom](https://npm.io/package/boom.md) ^3.1.2
- [hapi](https://npm.io/package/hapi.md) ^13.0.0
- [inert](https://npm.io/package/inert.md) ^3.2.0
- [bcrypt](https://npm.io/package/bcrypt.md) ^0.8.5
- [vision](https://npm.io/package/vision.md) ^4.0.1
- [validator](https://npm.io/package/validator.md) ^5.1.0
- [handlebars](https://npm.io/package/handlebars.md) ^4.0.5
- [hapi-login](https://npm.io/package/hapi-login.md) ^1.0.13
- [hapi-register](https://npm.io/package/hapi-register.md) ^1.0.13
- [redis-connection](https://npm.io/package/redis-connection.md) ^4.0.3

## Recent versions

- 1.0.13 (latest) — 2016-03-02
- 1.0.4 — 2015-11-08
- 1.0.2 — 2015-11-08

## README

# `hapi-login` *example*

[![Build Status](https://travis-ci.org/dwyl/hapi-login-example.svg)](https://travis-ci.org/dwyl/hapi-login-example)
[![codecov.io](http://codecov.io/github/dwyl/hapi-login-example/coverage.svg?branch=master)](http://codecov.io/github/dwyl/hapi-login-example?branch=master)
[![Code Climate](https://codeclimate.com/github/dwyl/hapi-login-example/badges/gpa.svg)](https://codeclimate.com/github/dwyl/hapi-login-example)
[![Dependency Status](https://david-dm.org/dwyl/hapi-login-example.svg)](https://david-dm.org/dwyl/hapi-login-example)
[![devDependency Status](https://david-dm.org/dwyl/hapi-login-example/dev-status.svg)](https://david-dm.org/dwyl/hapi-login-example#info=devDependencies)
[![HitCount](https://hitt.herokuapp.com/dwyl/hapi-login-example.svg)](https://github.com/dwyl/hapi-login-example)

## Why?

> "*For the things we have to learn before we can do them, we learn by doing them.*" ~ [Aristotle](https://www.goodreads.com/quotes/tag/learning-by-doing)

We did not *find* an ***end-to-end*** solution/tutorial
for ***login*** (*using email & password*) in Hapi.js apps,
so we *wrote* it.

If ***anything*** is ***unclear*** in this (*or any of our other repos*),
***please tell us***:
[![Join the chat at https://gitter.im/dwyl/chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dwyl/chat/)  



## What?

This repo is a *showcase* for how to use the
[**hapi-login**](https://github.com/nelsonic/hapi-login) plugin
for a *simple* (*yet complete*) web/app login process.


## Try it: https://hapi-login.herokuapp.com/

![login form](https://cloud.githubusercontent.com/assets/194400/10523082/6e7fab3c-7370-11e5-91e2-639fc725b3e6.png)

## How?

The best way to get started is to run this example *locally*.

#### 1. Clone the repo:

```sh
git clone git@github.com:dwyl/hapi-login-example.git
```
#### 2. Install *Dependencies* from NPM

```sh
npm install
```

#### 3. Run the Server

```sh
npm start
```

That's it.  
Now, ~~hack~~ *customise* it to your heart's content!

When you visit http://localhost:8000/ you will see a login form, you can login with any valid email address:
![hapi-login-01](https://cloud.githubusercontent.com/assets/194400/10522464/312648ca-736d-11e5-9f9f-36e39755b186.png)

Make sure the email address is valid:
![hapi-login-03](https://cloud.githubusercontent.com/assets/194400/10522488/47a24568-736d-11e5-8f3b-47a08699b09a.png)

Your password needs to be more than 6 characters long:
![hapi-login-05](https://cloud.githubusercontent.com/assets/194400/10522520/78b44052-736d-11e5-919f-903270075795.png)

We also use https://github.com/chriso/validator.js
to mitigate [Cross Site Scripting](https://en.wikipedia.org/wiki/Cross-site_scripting)
vulnerability:

Avoids Cross Site Scripting:
![hapi login avoids XSS](https://cloud.githubusercontent.com/assets/194400/10522594/db57b45a-736d-11e5-969a-844d186db80b.png)


## Want *More*?

If you would like to see this example *expanded*,
please either [***create an issue***](https://github.com/dwyl/hapi-login-example/issues)
with a *specific request* or [![Join the chat at https://gitter.im/dwyl/chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dwyl/chat/)

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