Skip to content
Browse files

Updated the instructions for the password module in README

  • Loading branch information...
1 parent 860a673 commit 82ce3e194ea6bb854c5db0e4eb50b22e12ecc21f @bnoguchi committed Apr 15, 2011
Showing with 20 additions and 9 deletions.
  1. +13 −2 README.md
  2. +7 −7 example/server.js
View
15 README.md
@@ -190,11 +190,22 @@ object whose parameter name keys map to description values:
.getLoginPath('/login') // Page with the login form
.postLoginPath('/login') // What you POST to
.loginView('a string of html; OR the name of the jade/etc-view-engine view')
- .redirectPath('/') // Where to redirect to after a login
.authenticate( function (login, password) {
// Returns a user if we can authenticate with the login + password.
// If we cannot, returns null/undefined
- });
+ })
+
+ .getRegisterPath('/register')
+ .postRegisterPath('/register')
+ .registerView('a string of html; OR the name of the jade/etc-view-engine view')
+ .registerUser( function (login, password) {
+ // Returns a user (or a Promise that promises a user) after adding it to
+ // some user store. You can also do things here like registration validation
+ // and re-directing back to the registration page upon invalid registration
+ })
+
+
+ .redirectPath('/'); // Where to redirect to after a login
var routes = function (app) {
// Define your routes here
View
14 example/server.js
@@ -43,6 +43,12 @@ everyauth
.getLoginPath('/login')
.postLoginPath('/login')
.loginView('login.jade')
+ .authenticate( function (login, password) {
+ var user = usersByLogin[login];
+ if (!user) return false;
+ if (user.password !== password) return false;
+ return user;
+ })
.getRegisterPath('/register')
.postRegisterPath('/register')
@@ -52,13 +58,7 @@ everyauth
login: login, password: password };
})
- .redirectPath('/')
- .authenticate( function (login, password) {
- var user = usersByLogin[login];
- if (!user) return false;
- if (user.password !== password) return false;
- return user;
- });
+ .redirectPath('/');
everyauth.github
.myHostname('http://local.host:3000')

0 comments on commit 82ce3e1

Please sign in to comment.
Something went wrong with that request. Please try again.