Permalink
Browse files

ea.password.loginName and ea.password.passwordName become ea.password…

….loginFormFieldName and ea.password.passwordFormFieldName. Updated README to reflect changes.
  • Loading branch information...
bnoguchi committed May 2, 2011
1 parent c9f8a85 commit 8a98435594e8dc9b1a2ee1d07666e4cdba0b4a40
Showing with 35 additions and 8 deletions.
  1. +28 −1 README.md
  2. +7 −7 lib/password.js
View
@@ -303,6 +303,30 @@ connect(
).listen(3000);
```
+You can also configure more parameters (most are set to defaults) via
+the same chainable API:
+
+```javascript
+everyauth.password
+ .loginFormFieldName('login') // Defaults to 'login'
+ .passwordFormFieldName('password') // Defaults to 'password'
+```
+
+If you want to see what the current value of a
+configured parameter is, you can do so via:
+
+```javascript
+everyauth.password.loginFormFieldName(); // 'login'
+everyauth.password.passwordFormFieldName(); // 'password'
+```
+
+To see all parameters that are configurable, the following will return an
+object whose parameter name keys map to description values:
+
+```javascript
+everyauth.password.configurable();
+```
+
## Setting up GitHub OAuth
```javascript
@@ -694,15 +718,18 @@ And that the function should return a `user` that is a user object or
a Promise that promises a user object.
```javascript
+// For synchronous lookup situations, you can return a user
function (session, accessToken, extra, oauthUser) {
...
return { id: 'some user id', username: 'some user name' };
}
// OR
+// For asynchronous lookup situations, you must return a Promise that
+// will be fulfilled with a user later on
function (session, accessToken, extra, oauthUser) {
- var promise = new everyauth.Promise();
+ var promise = this.Promise();
asyncFindUser( function (err, user) {
if (err) return promise.fail(err);
promise.fulfill(user);
View
@@ -3,20 +3,20 @@ var everyModule = require('./everymodule');
var password = module.exports =
everyModule.submodule('password')
.configurable({
- loginName: 'the name of the login field. Same as what you put in your login form '
- + '- e.g., if <input type="text" name="username" />, then loginName '
+ loginFormFieldName: 'the name of the login field. Same as what you put in your login form '
+ + '- e.g., if <input type="text" name="username" />, then loginFormFieldName '
+ 'should be set to "username".'
- , passwordName: 'the name of the login field. Same as what you put in your login form '
- + '- e.g., if <input type="password" name="pswd" />, then passwordName '
+ , passwordFormFieldName: 'the name of the login field. Same as what you put in your login form '
+ + '- e.g., if <input type="password" name="pswd" />, then passwordFormFieldName '
+ 'should be set to "pswd".'
, loginView: 'Either the name of the view (e.g., "login.jade") or the HTML string ' +
'that corresponds to the login page.'
, registerView: 'Either the name of the view (e.g., "register.jade") or the HTML string ' +
'that corresponds to the register page.'
, redirectPath: 'The path we redirect to after a login attempt.'
})
- .loginName('login')
- .passwordName('password')
+ .loginFormFieldName('login')
+ .passwordFormFieldName('password')
.get('getLoginPath', "the login page's uri path.")
.step('displayLogin')
.accepts('req res')
@@ -47,7 +47,7 @@ everyModule.submodule('password')
}
})
.extractLoginPassword( function (req, res) {
- return [req.body[this.loginName()], req.body[this.passwordName()]];
+ return [req.body[this.loginFormFieldName()], req.body[this.passwordFormFieldName()]];
})
.getSession( function (req) {
return req.session;

0 comments on commit 8a98435

Please sign in to comment.