hapi-login example

December 24, 2015 · View on GitHub

Build Status codecov.io Code Climate Dependency Status devDependency Status HitCount

Why?

"For the things we have to learn before we can do them, we learn by doing them." ~ Aristotle

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

What?

This repo is a showcase for how to use the hapi-login plugin for a simple (yet complete) web/app login process.

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

login form

How?

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

1. Clone the repo:

git clone git@github.com:dwyl/hapi-login-example.git

2. Install Dependencies from NPM

npm install

3. Run the Server

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

Make sure the email address is valid: hapi-login-03

Your password needs to be more than 6 characters long: hapi-login-05

We also use https://github.com/chriso/validator.js to mitigate Cross Site Scripting vulnerability:

Avoids Cross Site Scripting: hapi login avoids XSS

Want More?

If you would like to see this example expanded, please either create an issue with a specific request or Join the chat at https://gitter.im/dwyl/chat