diff --git a/controllers/registerController.js b/controllers/registerController.js index f2b683592f2579796230b4feab68d58a31d6d99f..be10a4efd6a96e577dbad5f9f70041a060b1a93b 100644 --- a/controllers/registerController.js +++ b/controllers/registerController.js @@ -10,11 +10,17 @@ module.exports = { const { email, rpassword } = req.body; try { + // Hash password const hashedPassword = await bcrypt.hash(rpassword, 10); + + // Insert user into the database const query = 'INSERT INTO users (email, password) VALUES (?, ?)'; await pool.execute(query, [email, hashedPassword]); + // Send success message req.flash('message', 'User registered successfully. Please log in.'); + + // Redirect to login page res.redirect('/login'); } catch (err) { console.error('Error inserting user:', err); @@ -22,3 +28,4 @@ module.exports = { } } }; + diff --git a/views/index.ejs b/views/index.ejs index 98e68e1f95f032740ca8677a38b6776161fbb513..6e6c201c1c98323b783292cf716cfd10222430d3 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -36,7 +36,7 @@ <div class="header_section"> <div class="container-fluid"> <nav class="navbar navbar-expand-lg navbar-light bg-light"> - <div class="logo"><a href="/"><h1 style="color: aliceblue;" class="h1">Bookshop</h1></a></div> + <div class="logo"><a href="/"><h1 style="color: aliceblue;" class="h1">ASA SHOP</h1></a></div> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav"aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> diff --git a/views/product.ejs b/views/product.ejs index fc95e980306ec8e1512939518fe5ba7d647de7b7..fb53a9985b99640e13850847e71847bc264d768d 100644 --- a/views/product.ejs +++ b/views/product.ejs @@ -3,7 +3,7 @@ <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> - <title><%= product.product_name %> | Bookshop</title> + <title><%= product.product_name %> | ASA SHOP</title> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/css/bootstrap.min.css"> <link rel="stylesheet" href="/css/product.css">