From f099408f95d25aa1fda507a5b9bdc0ffbbadb3b8 Mon Sep 17 00:00:00 2001 From: Piyush Dhamane Date: Thu, 10 Dec 2020 18:06:40 +0530 Subject: [PATCH 1/2] Displaying value fields in edit profile --- controls/auth.js | 2 +- routes/users.js | 2 +- views/edit_profile.ejs | 4 ++-- views/profile.ejs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/controls/auth.js b/controls/auth.js index 29c774eb..5852f244 100644 --- a/controls/auth.js +++ b/controls/auth.js @@ -167,7 +167,7 @@ exports.submission_subID = async (req, res, next) => { * route: /user/updateProfile */ exports.getUpdateProfile = (req, res, next) => { - res.render("edit_profile", { message: null }); + res.render("edit_profile", { 'data' : data }); } /**Updating the user info i.e. email, name and password diff --git a/routes/users.js b/routes/users.js index 35f37f1c..a0433b77 100644 --- a/routes/users.js +++ b/routes/users.js @@ -23,7 +23,7 @@ router.get("/submissions", enforceAuthentication(true, false), authController.su router.get("/submission/:subID", enforceAuthentication(true, false), authController.submission_subID); /**Display the user update profile page */ -router.get("/updateProfile", enforceAuthentication(true, false), authController.getUpdateProfile); +router.get("/updateProfile/:id", enforceAuthentication(true, false), authController.getUpdateProfile); /**POST: user profile update */ router.post("/updateProfile", enforceAuthentication(true, false), authController.postUpdateProfile); diff --git a/views/edit_profile.ejs b/views/edit_profile.ejs index d2773620..a10e0aba 100644 --- a/views/edit_profile.ejs +++ b/views/edit_profile.ejs @@ -29,13 +29,13 @@

Name - + >

Email - + >

diff --git a/views/profile.ejs b/views/profile.ejs index 4dad66e7..cb82106d 100644 --- a/views/profile.ejs +++ b/views/profile.ejs @@ -41,7 +41,7 @@ [ My submission history ]

- [ Update Profile ] + [ Update Profile ]

From 6c4ddb9e4bf6e597513260dc6ed729499c01f5e9 Mon Sep 17 00:00:00 2001 From: Piyush Dhamane Date: Thu, 10 Dec 2020 18:11:43 +0530 Subject: [PATCH 2/2] Displaying value fields in edit profile --- controls/auth.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/controls/auth.js b/controls/auth.js index 5852f244..aebc523d 100644 --- a/controls/auth.js +++ b/controls/auth.js @@ -167,7 +167,9 @@ exports.submission_subID = async (req, res, next) => { * route: /user/updateProfile */ exports.getUpdateProfile = (req, res, next) => { - res.render("edit_profile", { 'data' : data }); + user.findById(req.params.id, (err, data) => { + res.render("edit_profile", { 'data' : data }); + }) } /**Updating the user info i.e. email, name and password