mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-07 11:10:11 +08:00
change to use session for auth
+ replace BearerAuth to cookieAuth in swagger + add swagger.yaml to nodemon watch list
This commit is contained in:
1 parent
a6d02f2616
commit
be5cd152a9
13 files changed
+216
-71
No files matched your search
@@ -2,20 +2,24 @@ import { Router } from 'express'
|
||||
import passport from 'passport'
|
||||
|
||||
import {
|
||||
issueToken,
|
||||
register,
|
||||
checkUsername,
|
||||
logout,
|
||||
} from '../controllers/authController.js'
|
||||
|
||||
const router = Router()
|
||||
|
||||
router.post(
|
||||
'/login',
|
||||
passport.authenticate('local', { session: false, failWithError: true }),
|
||||
issueToken
|
||||
passport.authenticate('local', { failureMessage: true }),
|
||||
(req, res) => {
|
||||
res.json({ message: 'success' })
|
||||
}
|
||||
)
|
||||
|
||||
router.post('/register', register, issueToken)
|
||||
router.post('/register', register)
|
||||
|
||||
router.post('/logout', logout)
|
||||
|
||||
router.get('/check', checkUsername)
|
||||
|
||||
|
||||
Reference in new issue
Block a user