From 09e673eeec8f0dbb81955e6da774d056448bd7ba Mon Sep 17 00:00:00 2001 From: tanish35 Date: Wed, 30 Oct 2024 15:57:20 +0530 Subject: [PATCH] Fix font size --- backend/dist/controllers/userControllers.js | 28 +++++++++++++++++++-- backend/dist/lib/redis.js | 6 ++--- backend/src/lib/redis.ts | 6 ++--- frontend/src/styles/link.css | 12 +++++++++ 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/backend/dist/controllers/userControllers.js b/backend/dist/controllers/userControllers.js index 6a66e0e..e933758 100644 --- a/backend/dist/controllers/userControllers.js +++ b/backend/dist/controllers/userControllers.js @@ -22,6 +22,8 @@ const academic_email_verifier_1 = require("academic-email-verifier"); const checkAcademic_1 = __importDefault(require("../mail/checkAcademic")); const registerSchema_1 = require("../validation/registerSchema"); const redis_1 = __importDefault(require("../lib/redis")); +const redis_2 = require("../lib/redis"); +const axios_1 = __importDefault(require("axios")); const googleSignInOrSignUp = (0, express_async_handler_1.default)( //@ts-ignore (req, res) => __awaiter(void 0, void 0, void 0, function* () { @@ -125,12 +127,22 @@ const githubSignInOrSignUp = (0, express_async_handler_1.default)( exports.githubSignInOrSignUp = githubSignInOrSignUp; // @ts-ignore const registerUser = (0, express_async_handler_1.default)((req, res) => __awaiter(void 0, void 0, void 0, function* () { - const { email, username, password, collegeName, courseName, isOnline, location, } = req.body; + const { email, username, password, collegeName, courseName, isOnline, location, captchaToken, } = req.body; if (!process.env.SECRET) { throw new Error("Secret not found"); } + const response = yield axios_1.default.post(`https://www.google.com/recaptcha/api/siteverify`, {}, { + params: { + secret: process.env.RECAPTCHA_SECRET_KEY, + response: captchaToken, + }, + }); + const { success } = response.data; + if (!success) { + return res.status(400).json({ error: "Invalid captcha" }); + } const hashedPassword = yield bcrypt_1.default.hash(password, 8); - if (!email || !username || !password) { + if (!email || !username || !password || !captchaToken) { res.status(400).json({ message: "Please provide all fields" }); return; } @@ -632,7 +644,19 @@ const updateDetails = (0, express_async_handler_1.default)((req, res) => __await pic, }, }); + const college = yield prisma_1.default.userCourse.findFirst({ + where: { + user_id: userId, + }, + select: { + college_id: true, + }, + }); + if (!college) { + return res.status(404).json({ message: "User not found" }); + } yield redis_1.default.del(`user:${userId}`); + yield (0, redis_2.deleteCachedPosts)(college.college_id); return res.status(200).json({ message: "Details updated" }); })); exports.updateDetails = updateDetails; diff --git a/backend/dist/lib/redis.js b/backend/dist/lib/redis.js index 64eec8d..7448e31 100644 --- a/backend/dist/lib/redis.js +++ b/backend/dist/lib/redis.js @@ -64,14 +64,14 @@ const deleteCachedPosts = (collegeId) => __awaiter(void 0, void 0, void 0, funct } }); collegeStream.on("end", () => { - console.log(`Deleted cache for collegeId: ${collegeId}`); + // console.log(`Deleted cache for collegeId: ${collegeId}`); }); allStream.on("end", () => { - console.log(`Deleted all cache entries.`); + // console.log(`Deleted all cache entries.`); }); } catch (error) { - console.error("Error deleting cached posts from Redis", error); + // console.error("Error deleting cached posts from Redis", error); } }); exports.deleteCachedPosts = deleteCachedPosts; diff --git a/backend/src/lib/redis.ts b/backend/src/lib/redis.ts index 955488a..3e6d18f 100644 --- a/backend/src/lib/redis.ts +++ b/backend/src/lib/redis.ts @@ -53,14 +53,14 @@ export const deleteCachedPosts = async (collegeId: string): Promise => { } }); collegeStream.on("end", () => { - console.log(`Deleted cache for collegeId: ${collegeId}`); + // console.log(`Deleted cache for collegeId: ${collegeId}`); }); allStream.on("end", () => { - console.log(`Deleted all cache entries.`); + // console.log(`Deleted all cache entries.`); }); } catch (error) { - console.error("Error deleting cached posts from Redis", error); + // console.error("Error deleting cached posts from Redis", error); } }; diff --git a/frontend/src/styles/link.css b/frontend/src/styles/link.css index 5299cba..292b027 100644 --- a/frontend/src/styles/link.css +++ b/frontend/src/styles/link.css @@ -6,3 +6,15 @@ .custom-link:hover { text-decoration: underline; } + +.ql-size-huge { + font-size: 2.5em; +} + +.ql-size-large { + font-size: 1.5em; +} + +.ql-size-small { + font-size: 0.75em; +}