passport how to replace missing credential code example

Example: passport how to replace missing credential

const express = require('express')
const router = express.Router()
const passport = require('passport')
const { index } = require('../controllers/login.controller').loginController

router.get('/login', index)
router.post(
  '/login',
  passport.authenticate('local', {
    badRequestMessage: '<div class="alert alert-danger">User account is not exist</div>',
    failureFlash: true,
    successFlash: true,
    failureRedirect: '/user/login',
    successRedirect: '/'
  })
)

module.exports = router

Tags:

Misc Example