mirror of
https://github.com/wassname/talk.git
synced 2026-07-10 01:56:36 +08:00
Merge pull request #656 from coralproject/service-fix
Resolve facebook login issue
This commit is contained in:
@@ -40,6 +40,7 @@ const SetTokenForSafari = (req, res, token) => {
|
||||
if (browser.ios || browser.safari) {
|
||||
res.cookie('authorization', token, {
|
||||
httpOnly: true,
|
||||
secure: process.env.NODE_ENV === 'production',
|
||||
expires: new Date(Date.now() + ms(JWT_EXPIRY))
|
||||
});
|
||||
}
|
||||
|
||||
+13
-8
@@ -930,16 +930,21 @@ module.exports = class UsersService {
|
||||
|
||||
// Extract all the tokenUserNotFound plugins so we can integrate with other
|
||||
// providers.
|
||||
const tokenUserNotFoundHooks = require('./plugins')
|
||||
.get('server', 'tokenUserNotFound')
|
||||
.map(({plugin, tokenUserNotFound}) => {
|
||||
debug(`added plugin '${plugin.name}' to tokenUserNotFound hooks`);
|
||||
let tokenUserNotFoundHooks = null;
|
||||
|
||||
return tokenUserNotFound;
|
||||
});
|
||||
|
||||
// Provide a function that
|
||||
// Provide a function that can loop over the hooks and search for a provider
|
||||
// can crack the token to a user.
|
||||
const lookupUserNotFound = async (token) => {
|
||||
if (!Array.isArray(tokenUserNotFoundHooks)) {
|
||||
tokenUserNotFoundHooks = require('./plugins')
|
||||
.get('server', 'tokenUserNotFound')
|
||||
.map(({plugin, tokenUserNotFound}) => {
|
||||
debug(`added plugin '${plugin.name}' to tokenUserNotFound hooks`);
|
||||
|
||||
return tokenUserNotFound;
|
||||
});
|
||||
}
|
||||
|
||||
for (let hook of tokenUserNotFoundHooks) {
|
||||
let user = await hook(token);
|
||||
if (user !== null && typeof user !== 'undefined') {
|
||||
|
||||
Reference in New Issue
Block a user