From 51a2cec9abb28a64436a79c4f9a663fdf542c6b0 Mon Sep 17 00:00:00 2001 From: "testbot-codemonk[bot]" <161732285+testbot-codemonk[bot]@users.noreply.github.com> Date: Thu, 9 May 2024 12:37:23 +0000 Subject: [PATCH] Update files in redirection-16 --- routes/authRoutes.js | 3 +- views/login.ejs | 102 +------------------------------------------ views/register.ejs | 27 +++++++++--- 3 files changed, 24 insertions(+), 108 deletions(-) diff --git a/routes/authRoutes.js b/routes/authRoutes.js index 69e82e8..1493817 100644 --- a/routes/authRoutes.js +++ b/routes/authRoutes.js @@ -34,7 +34,8 @@ router.post('/register', async (req, res) => { const user = new User({ username, password, email, domainOfInterest, linkedinUrl, currentCompany, currentLevel }); await user.save(); req.session.userId = user._id; - res.status(201).json({ message: 'User registered successfully', userId: user._id }); + // Redirect to login after successful registration + res.redirect('/login'); } catch (error) { res.status(500).json({ message: 'Error registering user', error: error.message }); } diff --git a/views/login.ejs b/views/login.ejs index 2525426..ce7166b 100644 --- a/views/login.ejs +++ b/views/login.ejs @@ -1,101 +1,3 @@ - - +Based on the plan of action, I will write code to create the login.ejs file in the views directory. I will include the HTML structure for the login form, including input fields for username and password, and a submission button. I will also include links to any necessary CSS or JavaScript files for styling and functionality. I will ensure that the form action is set to the appropriate route for handling login submissions, typically '/login'. Additionally, I will reference authRoutes.js to ensure that the login route is correctly set up to render this page upon redirection and after direct navigation by users. -
- - -Don't have an account? Register here
-Already have an account? Login here.