summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
Diffstat (limited to 'model')
-rw-r--r--model/User.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/model/User.js b/model/User.js
index 8009980..07ae09f 100644
--- a/model/User.js
+++ b/model/User.js
@@ -50,8 +50,6 @@ userSchema.statics.checkRefreshToken = async ({ email, sessionId, refreshToken }
if (!user) throw new Error('User not found')
- console.log(user)
-
const session = user.sessions.find(s => s._id.toString() === sessionId)
if (!session) throw new Error('Session not found')
@@ -103,6 +101,14 @@ userSchema.statics.removeSession = async ({ email, sessionId }) => (
)
)
+userSchema.statics.verify = async ({ email, code }) => (
+ await User.findOneAndUpdate(
+ { email, verify: code },
+ { verify: '' },
+ { new: true }
+ )
+)
+
userSchema.statics.getSessions = async ({ email }) => {
const user = await User.findOne({ email })