From a169a25957de4473c651a731a3fbf392cecc4ea1 Mon Sep 17 00:00:00 2001 From: Abdinasir Mursal Date: Sun, 10 Mar 2024 08:52:17 -0700 Subject: [PATCH 01/12] feat: renamed hashed to hashedPassword --- .../src/controllers/authController.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/src/controllers/authController.js b/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/src/controllers/authController.js index 0efb284a..3255ca2a 100644 --- a/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/src/controllers/authController.js +++ b/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/src/controllers/authController.js @@ -14,9 +14,9 @@ export async function registerUser(req, res) { return res.status(400).json({ message: "User already exists" }); } // Hash the password before saving it - const hashed = await hashPassword(password); - // Create a new user instance with the hashed password and save it to the database - user = new User({ email, password: hashed }); + const hashedPassword = await hashPassword(password); + // Create a new user instance with the hashedPassword password and save it to the database + user = new User({ email, password: hashedPassword }); await user.save(); // Respond with the generated token res.status(201).json({ message: "User created successfully" }); From e446cb0120ed6602db9882a58ad8e1c5b3c6046a Mon Sep 17 00:00:00 2001 From: Abdinasir Mursal Date: Sun, 10 Mar 2024 08:53:52 -0700 Subject: [PATCH 02/12] feat: renamed hashed to hashedPassword --- .../src/controllers/authController.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/src/controllers/authController.js b/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/src/controllers/authController.js index a60741a5..84c09491 100644 --- a/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/src/controllers/authController.js +++ b/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/src/controllers/authController.js @@ -14,9 +14,11 @@ export async function registerUser(req, res) { return res.status(400).json({ message: "User already exists" }); } // Hash the password before saving it - const hashed = await hashPassword(password); - // Create a new user instance with the hashed password and save it to the database - user = await prisma.user.create({ data: { email, password: hashed } }); + const hashedPassword = await hashPassword(password); + // Create a new user instance with the hashedPassword password and save it to the database + user = await prisma.user.create({ + data: { email, password: hashedPassword }, + }); // Respond with the created user res.status(201).json({ message: "User created successfully" }); } catch (error) { From 17f4ffeb8286eea81cea4a4c44f57377bada512f Mon Sep 17 00:00:00 2001 From: Abdinasir Mursal Date: Sun, 10 Mar 2024 09:06:15 -0700 Subject: [PATCH 03/12] feat: changed commens --- .../src/controllers/authController.js | 2 +- .../src/controllers/authController.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/src/controllers/authController.js b/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/src/controllers/authController.js index 3255ca2a..cc7cdbbc 100644 --- a/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/src/controllers/authController.js +++ b/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/src/controllers/authController.js @@ -15,7 +15,7 @@ export async function registerUser(req, res) { } // Hash the password before saving it const hashedPassword = await hashPassword(password); - // Create a new user instance with the hashedPassword password and save it to the database + // Create a new user instance with the hashed password and save it to the database user = new User({ email, password: hashedPassword }); await user.save(); // Respond with the generated token diff --git a/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/src/controllers/authController.js b/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/src/controllers/authController.js index 84c09491..3b61d175 100644 --- a/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/src/controllers/authController.js +++ b/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/src/controllers/authController.js @@ -15,7 +15,7 @@ export async function registerUser(req, res) { } // Hash the password before saving it const hashedPassword = await hashPassword(password); - // Create a new user instance with the hashedPassword password and save it to the database + // Create a new user instance with the hashed password and save it to the database user = await prisma.user.create({ data: { email, password: hashedPassword }, }); From 70a1a09c3eb557e8fef70c8dfb2e2020bafa6bfc Mon Sep 17 00:00:00 2001 From: Abdinasir Mursal Date: Sun, 10 Mar 2024 09:11:08 -0700 Subject: [PATCH 04/12] feat: renamed hashed to hashedPassword --- .../src/controllers/authController.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/src/controllers/authController.js b/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/src/controllers/authController.js index 47df019a..416e6b89 100644 --- a/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/src/controllers/authController.js +++ b/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/src/controllers/authController.js @@ -18,12 +18,12 @@ export async function registerUser(req, res) { return res.status(400).json({ message: "User already exists" }); } - const hashed = await hashPassword(password); - - // Create a new user instance and save it to the database + // Hash the password before saving it + const hashedPassword = await hashPassword(password); + // Create a new user instance with the hashed password and save it to the database user = userRepository.create({ email, - password: hashed, + password: hashedPassword, }); await userRepository.save(user); console.log(user); From c304c44291661a31ff41a6554b3917c868f49fcd Mon Sep 17 00:00:00 2001 From: Abdinasir Mursal Date: Sun, 10 Mar 2024 09:12:37 -0700 Subject: [PATCH 05/12] feat: renamed hashed to hashedPassword --- .../src/controllers/authController.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/src/controllers/authController.js b/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/src/controllers/authController.js index e2fc76f6..2c6b4537 100644 --- a/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/src/controllers/authController.js +++ b/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/src/controllers/authController.js @@ -15,11 +15,11 @@ export async function registerUser(req, res) { } // Hash the password - const hashed = await hashPassword(password); + const hashedPassword = await hashPassword(password); // Create a new user instance and save it to the database user = await prisma.user.create({ - data: { email, password: hashed }, + data: { email, password: hashedPassword }, }); // Respond with the created user res.status(201).json({ user }); From 93d53e6a07f8c00bcfaf94c85c668287114fb6f1 Mon Sep 17 00:00:00 2001 From: Abdinasir Mursal Date: Sun, 10 Mar 2024 09:14:18 -0700 Subject: [PATCH 06/12] feat: renamed hashed to hashedPassword --- .../src/controllers/authController.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/src/controllers/authController.js b/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/src/controllers/authController.js index ddde4ea7..19897c52 100644 --- a/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/src/controllers/authController.js +++ b/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/src/controllers/authController.js @@ -13,9 +13,9 @@ export async function registerUser(req, res) { return res.status(400).json({ message: "User already exists" }); } // Hash the password before saving it - const hashed = await hashPassword(password); + const hashedPassword = await hashPassword(password); // Create a new user builder and save it to the database - user = User.build({ email, password:hashed }); + user = User.build({ email, password: hashedPassword }); await user.save(); res.status(201).json({ message: "User created successfully" }); } catch (error) { @@ -40,7 +40,7 @@ export async function loginUser(req, res) { if (!isMatch) { return res.status(400).json({ message: "Invalid Credentials" }); } - + // Create a JWT payload and generate a token const payload = { userId: user._id }; const token = jwt.sign(payload, jwtSecret, { @@ -52,4 +52,4 @@ export async function loginUser(req, res) { // Handle any errors that occur during the registration process res.status(500).json({ message: "Server Error" }); } -} \ No newline at end of file +} From 14d7360156e24e9d3cf0503414c09f62e6b78b3b Mon Sep 17 00:00:00 2001 From: Abdinasir Mursal Date: Sun, 10 Mar 2024 09:15:21 -0700 Subject: [PATCH 07/12] feat: renamed hashed to hashedPassword --- .../src/controllers/authController.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/src/controllers/authController.js b/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/src/controllers/authController.js index fdbadd4c..4637b12a 100644 --- a/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/src/controllers/authController.js +++ b/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/src/controllers/authController.js @@ -18,12 +18,12 @@ export async function registerUser(req, res) { return res.status(400).json({ message: "User already exists" }); } - const hashed = await hashPassword(password); + const hashedPassword = await hashPassword(password); // Create a new user instance and save it to the database user = userRepository.create({ email, - password: hashed, + password: hashedPassword, }); await userRepository.save(user); From 87c0eae12043c544a85aaaee2df75262dd95d521 Mon Sep 17 00:00:00 2001 From: Abdinasir Mursal Date: Sun, 10 Mar 2024 09:16:20 -0700 Subject: [PATCH 08/12] feat: renamed hashed to hashedPassword --- .../src/controllers/authController.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/src/controllers/authController.js b/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/src/controllers/authController.js index 90b1d225..e85174d2 100644 --- a/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/src/controllers/authController.js +++ b/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/src/controllers/authController.js @@ -15,11 +15,11 @@ export async function registerUser(req, res) { } // Hash the password - const hashed = await hashPassword(password); + const hashedPassword = await hashPassword(password); // Create a new user instance and save it to the database user = await prisma.user.create({ - data: { email, password: hashed }, + data: { email, password: hashedPassword }, }); // Respond with the created user res.status(201).json({ message: "User created successfully" }); From 4837b8f1bf179a302f53934d351be7fad461df30 Mon Sep 17 00:00:00 2001 From: Abdinasir Mursal Date: Sun, 10 Mar 2024 09:18:13 -0700 Subject: [PATCH 09/12] feat: renamed hashed to hashedPassword --- .../src/controllers/authController.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/src/controllers/authController.js b/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/src/controllers/authController.js index 0b5df812..2c702b71 100644 --- a/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/src/controllers/authController.js +++ b/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/src/controllers/authController.js @@ -13,9 +13,9 @@ export async function registerUser(req, res) { return res.status(400).json({ message: "User already exists" }); } // Hash the password before saving it - const hashed = await hashPassword(password); + const hashedPassword = await hashPassword(password); // Create a new user builder and save it to the database - user = User.build({ email, password:hashed }); + user = User.build({ email, password: hashedPassword }); await user.save(); res.status(201).json({ message: "User created successfully" }); } catch (error) { @@ -40,7 +40,7 @@ export async function loginUser(req, res) { if (!isMatch) { return res.status(400).json({ message: "Invalid Credentials" }); } - + // Create a JWT payload and generate a token const payload = { userId: user._id }; const token = jwt.sign(payload, jwtSecret, { From 92eefee3b0519496148283ac68e23aafc3cfef90 Mon Sep 17 00:00:00 2001 From: Abdinasir Mursal Date: Sun, 10 Mar 2024 09:20:33 -0700 Subject: [PATCH 10/12] feat: renamed hashed to hashedPassword --- .../src/controllers/authController.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/src/controllers/authController.js b/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/src/controllers/authController.js index fdbadd4c..9a267756 100644 --- a/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/src/controllers/authController.js +++ b/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/src/controllers/authController.js @@ -17,13 +17,12 @@ export async function registerUser(req, res) { if (user) { return res.status(400).json({ message: "User already exists" }); } - - const hashed = await hashPassword(password); - + // Hash the password before saving it + const hashedPassword = await hashPassword(password); // Create a new user instance and save it to the database user = userRepository.create({ email, - password: hashed, + password: hashedPassword, }); await userRepository.save(user); From 31757d361a52a029fda52cb898f67ea378cb6ba9 Mon Sep 17 00:00:00 2001 From: Abdinasir Mursal Date: Sun, 10 Mar 2024 09:28:37 -0700 Subject: [PATCH 11/12] feat: changed some comments --- .../src/controllers/authController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/src/controllers/authController.js b/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/src/controllers/authController.js index cc7cdbbc..69a21861 100644 --- a/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/src/controllers/authController.js +++ b/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/src/controllers/authController.js @@ -15,7 +15,7 @@ export async function registerUser(req, res) { } // Hash the password before saving it const hashedPassword = await hashPassword(password); - // Create a new user instance with the hashed password and save it to the database + // Create a new user instance and save it to the database user = new User({ email, password: hashedPassword }); await user.save(); // Respond with the generated token From d2475a514db758bfb310d6af9829f0b9eacd3e19 Mon Sep 17 00:00:00 2001 From: Abdinasir Mursal Date: Sun, 10 Mar 2024 09:34:23 -0700 Subject: [PATCH 12/12] feat: removed some comments --- .../src/controllers/authController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/src/controllers/authController.js b/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/src/controllers/authController.js index 3b61d175..eb2465f9 100644 --- a/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/src/controllers/authController.js +++ b/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/src/controllers/authController.js @@ -15,7 +15,7 @@ export async function registerUser(req, res) { } // Hash the password before saving it const hashedPassword = await hashPassword(password); - // Create a new user instance with the hashed password and save it to the database + // Create a new user instance and save it to the database user = await prisma.user.create({ data: { email, password: hashedPassword }, });