Why the request does not reach passport?

Good afternoon.Please tell me why I can't authenticate the user,and I immediately redirects to the page regardless of whether authorised or not.In other words, why the request does not reach the passport which entails function does not work.

passport.js:

const { mysql,passport,localStrategy,bcrypt } = require('./packages')
const { pool } = require('./mysql')

passport.serializeUser(function(user, done) {

 done(null, user.id)

})

passport.deserializeUser(function(id, done) {

 pool.query("SELECT * FROM users WHERE id='"+id+"'",function(err,res){ 
 done(null, id)
})

})

passport.use(new localStrategy({ usernameField: 'email' },
 async (email, password, done) => {

 pool.query("SELECT * FROM users WHERE email = '" + email + "'", async (err,res) => {

 if (res.length < 1) {

 console.log(`Banned access for: ${email}`)

 return done(null,false)

}

 else {

 const user = res[0]
 const Email = user.email
 const Pass = user.password
 const Phone = user.phone

 console.log(`access for Success: ${Email}`)

 bcrypt.compare(password, Pass, async (err, res) => {
 if(res) {

console.log(user)

 return done(null,user)

}

})

}

})
}
))


check_page:

const successAccess = (req,res,next) => {
 if(req.the isAuthenticated()) next()
 else return res.redirect('/')
}

const bannedAccess = (req,res,next) => {
 if(req.the isAuthenticated()) return res.redirect('/admin')
 else next()
}

module.exports = { successAccess,bannedAccess }


default_page:

const { app static } = require('../modules/app_config')
const { bannedAccess } = require('../modules/check_page')
const { passport } = require('../modules/passport')

app.get('/',bannedAccess, (req, res) => {

Res. sendFile(`${static}/index.html`)

})


app:

//Export project modules
const { express,passport,session,util,mysql,fileStore,localStrategy,bcrypt,saltRounds } = require('./modules/packages')

//Export project routes
const { DEFAULT_PAGE } = require('./routes/default_page')


index.html:

<form id="login" action="/" method="POST">

<h1>Authorization</h1>

 <input id="email" type="email" placeholder="Email" name="email" required>
 <input id="pass" type="password" placeholder="Password" name="password" required>
 <div class="info">
 <div class="reset-password"><label>Enter your password.Forgot?You will help </label> <a href="#">password recovery</a></div>
 <div class="cookie"><div class="checkbox"></div><label>Remember me at<label></div>
</div>

 <div class="submit">
 <button type="submit" class="auth">Login</button>
 <div class="or">or <a class="register" href="#">register</a></div>
</div>

 </form>
April 3rd 20 at 18:31
1 answer
April 3rd 20 at 18:33
because you passport itself anywhere did not cause.
add
app.use(passport.initialize())
and passport.authentificate in ranting. In General - to begin with do as in the documentation.
I did it in the app_config,I changed the path for the static,everything is broken,returned to - work.I do not understand how it is connected,I have all the modules outside the www folder,and I put statics in the www and all broken,now,thank you - Angela.Larkin commented on April 3rd 20 at 18:36

Find more questions by tags JavaScriptNode.js