FIX: UserSeeder
ADD: Get-Self endpoint for users ADD: Category and Role Seeder FIX: Login Check Bug ADD: Extra fields for documents and images in belonging model ADD: localhost:5173 to cors ADD: SuperAdmin ID to env
This commit is contained in:
@@ -7,7 +7,8 @@ exports.loginProtect = async (req, res, next) => {
|
||||
// 1) Getting token and check if it's there
|
||||
let token
|
||||
|
||||
token = req.cookies.jwt || req.cookies['crm-jwt']
|
||||
|
||||
token = req.cookies['bm-token']
|
||||
|
||||
if (req.headers.authorization && req.headers.authorization.startsWith('Bearer')) {
|
||||
token = req.headers.authorization.split(' ')[1]
|
||||
@@ -30,6 +31,7 @@ exports.loginProtect = async (req, res, next) => {
|
||||
// 3) check if user still exist
|
||||
const loggedInUser = await User.findById(decodedToken.id).populate('role')
|
||||
|
||||
|
||||
if (!loggedInUser) {
|
||||
return next(new AppError('TokenUserNotExist', 401, {}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user