mirror of
https://github.com/wassname/talk.git
synced 2026-06-30 14:06:02 +08:00
Updated docs, hook names
This commit is contained in:
+6
-3
@@ -233,7 +233,7 @@ module.exports = {
|
||||
}
|
||||
```
|
||||
|
||||
#### Field: `auth`
|
||||
#### Field: `passport`
|
||||
|
||||
```js
|
||||
const FacebookStrategy = require('passport-facebook').Strategy;
|
||||
@@ -241,7 +241,7 @@ const UsersService = require('services/users');
|
||||
const {ValidateUserLogin, HandleAuthPopupCallback} = require('services/passport');
|
||||
|
||||
module.exports = {
|
||||
auth(passport) {
|
||||
passport(passport) {
|
||||
passport.use(new FacebookStrategy({
|
||||
clientID: process.env.TALK_FACEBOOK_APP_ID,
|
||||
clientSecret: process.env.TALK_FACEBOOK_APP_SECRET,
|
||||
@@ -260,7 +260,10 @@ module.exports = {
|
||||
return ValidateUserLogin(profile, user, done);
|
||||
}));
|
||||
},
|
||||
routes(router) {
|
||||
router(router) {
|
||||
|
||||
// Note that we have to import the passport instance here, it is
|
||||
// instantiated after all the strategies have been mounted.
|
||||
const {passport} = require('services/passport');
|
||||
|
||||
/**
|
||||
|
||||
+3
-3
@@ -25,11 +25,11 @@ if (process.env.NODE_ENV !== 'production') {
|
||||
}
|
||||
|
||||
// Inject server route plugins.
|
||||
plugins.get('server', 'routes').forEach(({plugin, routes}) => {
|
||||
debug(`added plugin '${plugin.name}'`);
|
||||
plugins.get('server', 'router').forEach((plugin) => {
|
||||
debug(`added plugin '${plugin.plugin.name}'`);
|
||||
|
||||
// Pass the root router to the plugin to mount it's routes.
|
||||
routes(router);
|
||||
plugin.router(router);
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
||||
@@ -377,12 +377,12 @@ if (process.env.TALK_FACEBOOK_APP_ID && process.env.TALK_FACEBOOK_APP_SECRET &&
|
||||
}
|
||||
|
||||
// Inject server route plugins.
|
||||
plugins.get('server', 'auth').forEach(({plugin, auth}) => {
|
||||
debug(`added plugin '${plugin.name}'`);
|
||||
plugins.get('server', 'passport').forEach((plugin) => {
|
||||
debug(`added plugin '${plugin.plugin.name}'`);
|
||||
|
||||
// Pass the passport.js instance to the plugin to allow it to inject it's
|
||||
// functionality.
|
||||
auth(passport);
|
||||
plugin.passport(passport);
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in New Issue
Block a user