cms
This commit is contained in:
parent
53c55e2722
commit
52a4570e85
@ -242,3 +242,6 @@ export const getSingleRegisterUser = async (req, res) => {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//share app (api)
|
@ -17,9 +17,13 @@ export const isAuthenticatedUser = async (req, res, next) => {
|
||||
//remove Bearer from token
|
||||
const fronttoken = getToken.authorization.slice(7);
|
||||
|
||||
|
||||
const frontdecoded = jwt.verify(fronttoken, process.env.JWT_SECRET);
|
||||
|
||||
if (!frontdecoded) {
|
||||
return res.status(200).json({
|
||||
success: false,
|
||||
message: "incorrect token",
|
||||
});
|
||||
}
|
||||
const fuser = await User.findById(frontdecoded.id);
|
||||
|
||||
req.user = fuser;
|
||||
|
@ -66,7 +66,7 @@ userSchema.pre("save", async function (next) {
|
||||
userSchema.methods.getJWTToken = function () {
|
||||
return jwt.sign({ id: this._id }, process.env.JWT_SECRET);
|
||||
};
|
||||
// console.log(process.env.JWT_SECRET)
|
||||
|
||||
|
||||
// Compare Password
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user