diff --git a/controls/auth.js b/controls/auth.js index 29c774eb..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", { message: null }); + user.findById(req.params.id, (err, data) => { + 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 ]