Impementing Time-Based One-Time Password, authentication based on a random generated serial number, as described here: https://tools.ietf.org/html/rfc6238
2 factor auth is based on 2 components, 1º is what user knows like a password, 2º is something that user have, like a cell phone. This is just an example implementation, for example this could be a phonegap app that generates serial codes and stores them as a passcode. The user can then associate that serial to the user account, each time the user wants to access is account he/she need's to check the app and provide the OTP + password.
npm install
grunt default
node server/bin.js
Open your browser with http://localhost:8080/
- change Math.random() to a true random Algorithm