An error occurred while node Plus express was processing the login.

  node.js, question

This is the code registered in index.js

app.get( '/login', function (req, res) {
 Res.render ('login',' title:' login'});
 }); '/login', function (req, res) {
 //Generate md5 value of password
 var md5 = crypto.createHash('md5'),
 password = md5.update(req.body.password).digest('hex');
 //Check if the user exists
 User.get(, function (err, user) {
 if (!  user) {
 Flash ('error',' user does not exist!'  );
 return res.redirect('/login');  //If the user does not exist, jump to the login page.
 //Check whether passwords are consistent
 if (user.password !  = password) {
 Req.flash('error',' password error!'  );
 return res.redirect('/login');  //If the password is wrong, jump to the login page.
 //After the user name and password match, save the user information into the session
 req.session.user = user;
 Req.flash('success',' login success!'  );
 res.redirect('/');  //Jump to homepage after successful login

However, an error occurred after the operation, as follows:

 500 ReferenceError: /home/lu/node/blog/views/login.ejs:15<br/><br/><br/>user is not defined
 user is not defined
 at __line (eval at (/home/lu/node/blog/node_modules/ejs/lib/ejs.js:464:12), :14:12)
 at eval (eval at (/home/lu/node/blog/node_modules/ejs/lib/ejs.js:464:12), :39:9)
 at returnedFn (/home/lu/node/blog/node_modules/ejs/lib/ejs.js:493:17)
 at View.exports.renderFile [as engine] (/home/lu/node/blog/node_modules/ejs/lib/ejs.js:350:31)
 at View.render (/home/lu/node/blog/node_modules/express/lib/view.js:76:8)
 at (/home/lu/node/blog/node_modules/express/lib/application.js:504:10)
 at ServerResponse.res.render (/home/lu/node/blog/node_modules/express/lib/response.js:801:7)
 at /home/lu/node/blog/routes/index.js:60:7
 at callbacks (/home/lu/node/blog/node_modules/express/lib/router/index.js:164:37)
 at param (/home/lu/node/blog/node_modules/express/lib/router/index.js:138:11)

Asking for answers from experts. . .

The modification code is:

app.get( '/login', function (req, res) {
 res.render('login', {
 Title:' login',
 success: req.flash('success').toString(),
 error: req.flash('error').toString()