mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: add UserProfile collection, create on login
* add progress
This commit is contained in:
1 parent
e981bff3bb
commit
45f12acbd9
5 files changed
+75
-22
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import passport from 'passport'
|
||||
import { UserProfile } from '@linux-odyssey/models'
|
||||
import passwordStrategy from './passwordStrategy.js'
|
||||
import jwtStrategy from './jwtStrategy.js'
|
||||
import googleStrategy from './googleStrategy.js'
|
||||
@@ -24,7 +25,10 @@ if (enabledMethods.github) {
|
||||
}
|
||||
|
||||
passport.serializeUser((user, done) => {
|
||||
process.nextTick(() => {
|
||||
process.nextTick(async () => {
|
||||
if (!(await UserProfile.exists({ user: user._id }))) {
|
||||
UserProfile.create({ user: user._id })
|
||||
}
|
||||
done(null, {
|
||||
_id: user._id,
|
||||
username: user.username,
|
||||
|
||||
Reference in new issue
Block a user