location update optimized with schema changes and geoJson Compatability testing endpoint with encrypted key authorization
This commit is contained in:
@@ -4,6 +4,7 @@ import dayjs from "dayjs";
|
||||
import {
|
||||
getAccessToken,
|
||||
getRefreshToken,
|
||||
getEncryptedPayload,
|
||||
} from "../middlewares/jwt.middleware.js";
|
||||
|
||||
export const createUserController = async (req, res, next) => {
|
||||
@@ -45,14 +46,20 @@ export const loginController = async (req, res, next) => {
|
||||
}
|
||||
|
||||
const accessToken = getAccessToken({ id: userExists._id });
|
||||
const encryptedKey = getEncryptedPayload({ id: userExists._id });
|
||||
const refreshToken = getRefreshToken();
|
||||
|
||||
userExists.refreshToken = refreshToken;
|
||||
await userExists.save();
|
||||
|
||||
res
|
||||
.status(200)
|
||||
.json({ result: { accessToken, refreshToken, name: userExists?.name } });
|
||||
res.status(200).json({
|
||||
result: {
|
||||
accessToken,
|
||||
refreshToken,
|
||||
encryptedKey,
|
||||
name: userExists?.name,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("loginController Error", error);
|
||||
next(error);
|
||||
@@ -73,4 +80,3 @@ export const renewAccessTokenController = async (req, res, next) => {
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user