Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit 71822e15 authored by 65160394's avatar 65160394
Browse files

Project Round 2

parent 66d612ce
Branches
No related tags found
No related merge requests found
...@@ -42,9 +42,12 @@ exports.postLogin = (req, res) => { ...@@ -42,9 +42,12 @@ exports.postLogin = (req, res) => {
exports.postRegister = (req, res) => { exports.postRegister = (req, res) => {
const { name, email, password, confirmPassword } = req.body; const { name, email, password, confirmPassword } = req.body;
console.log(password, confirmPassword); // ดูค่าที่ส่งเข้ามา
if (password !== confirmPassword) { if (password !== confirmPassword) {
return res.render('register', { message: 'Passwords do not match' }); return res.render('register', { message: 'Passwords do not match' });
} }
User.findOne(email, (err, user) => { User.findOne(email, (err, user) => {
if (user) { if (user) {
return res.render('register', { message: 'Email already in use' }); return res.render('register', { message: 'Email already in use' });
...@@ -56,3 +59,4 @@ exports.postRegister = (req, res) => { ...@@ -56,3 +59,4 @@ exports.postRegister = (req, res) => {
}); });
}); });
}; };
...@@ -17,19 +17,19 @@ ...@@ -17,19 +17,19 @@
<form action="/register" method="POST"> <form action="/register" method="POST">
<div class="input-group"> <div class="input-group">
<label for="name">Name</label> <label for="name">Name</label>
<input type="text" name="name" id="name" required> <input type="text" name="name" required placeholder="Name">
</div> </div>
<div class="input-group"> <div class="input-group">
<label for="email">Email</label> <label for="email">Email</label>
<input type="email" name="email" id="email" required> <input type="email" name="email" required placeholder="Email">
</div> </div>
<div class="input-group"> <div class="input-group">
<label for="password">Password</label> <label for="password">Password</label>
<input type="password" name="password" id="password" required> <input type="password" name="password" required placeholder="Password">
</div> </div>
<div class="input-group"> <div class="input-group">
<label for="confirm-password">Confirm Password</label> <label for="confirm-password">Confirm Password</label>
<input type="password" name="confirm-password" id="confirm-password" required> <input type="password" name="confirmPassword" required placeholder="Confirm Password">
</div> </div>
<button type="submit">Register</button> <button type="submit">Register</button>
</form> </form>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment