Begin preliminary tokenVersion impl

This commit is contained in:
Tuan Dang
2023-06-06 11:25:08 +01:00
parent 5a1b6acc93
commit b9dad5c3f0
10 changed files with 195 additions and 90 deletions
+5 -1
View File
@@ -113,7 +113,7 @@ export const login2 = async (req: Request, res: Response) => {
const user = await User.findOne({
email,
}).select('+salt +verifier +encryptionVersion +protectedKey +protectedKeyIV +protectedKeyTag +publicKey +encryptedPrivateKey +iv +tag');
}).select('+salt +verifier +encryptionVersion +protectedKey +protectedKeyIV +protectedKeyTag +publicKey +encryptedPrivateKey +iv +tag +devices');
if (!user) throw new Error('Failed to find user');
@@ -183,6 +183,10 @@ export const login2 = async (req: Request, res: Response) => {
userAgent: req.headers['user-agent'] ?? ''
});
console.log('logged in, issue tokens');
console.log('ip: ', req.ip);
console.log('userAgent: ', req.headers['user-agent']);
// issue tokens
const tokens = await issueAuthTokens({ userId: user._id.toString() });