I am using nodeJS and express to create a simple log in form where user need to put their email and password to log in. For example, in client side:
form(action='/login', method='post')
.form-group
label Email
input.form-control(type='text', name='email')
span#message
.form-group
label Password
input.form-control(type='password', name='password')
button.btn.btn-warning.btn-lg(type='submit') Login
In server side:
router.get('/', function(req, res, next) {
res.render('index', { title: 'Login' });
// process the login form
router.post('/login', function(req, res){
if(req.body.email && req.body.password == 'pass123') {
res.redirect('/myHomePage);
}else {
res.redirect('/');
}
});
My question is, how can I check if user is enter the valid email and valid password (which declared in server-side (pass123)). How can I have a popup/ or a message on client side to tell user that they input the wrong username/password.
I am not using any database at the moment.