mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
BREAKING: change user social login schema
This commit is contained in:
1 parent
9e935b320a
commit
81581c4635
8 files changed
+59
-32
No files matched your search
@@ -26,14 +26,18 @@ if (enabledMethods.github) {
|
||||
|
||||
passport.serializeUser((user, done) => {
|
||||
process.nextTick(async () => {
|
||||
if (!(await UserProfile.exists({ user: user._id }))) {
|
||||
UserProfile.create({ user: user._id })
|
||||
try {
|
||||
if (user._id && !(await UserProfile.exists({ user: user._id }))) {
|
||||
await UserProfile.create({ user: user._id })
|
||||
}
|
||||
done(null, {
|
||||
_id: user._id,
|
||||
username: user.username,
|
||||
email: user.email,
|
||||
})
|
||||
} catch (err) {
|
||||
done(err)
|
||||
}
|
||||
done(null, {
|
||||
_id: user._id,
|
||||
username: user.username,
|
||||
email: user.email,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user