Forráskód Böngészése

Destroy session on deletion of account

sbkwgh 8 éve
szülő
commit
c633d7895c
1 módosított fájl, 4 hozzáadás és 1 törlés
  1. 4 1
      routes/user.js

+ 4 - 1
routes/user.js

@@ -365,7 +365,10 @@ router.delete('/:username', async (req, res) => {
 
 		await user.destroy()
 
-		res.json({ success: true })
+		req.session.destroy(() => {
+			res.clearCookie('username')
+			res.json({ success: true })
+		})
 
 	} catch (e) {
 		if(validationErrors.length) {