nodejs mongodb chrome 暴露密码潜在数据泄露修复

nodejs mongodb chrome exposed password potential databreach fix

我在 Web 应用程序上使用 mongodb 和 nodejs,使用 chrome 作为我的浏览器。当我登录到我的系统时,它通过 passport.js 进行身份验证。但是 chrome 认为这是一个暴露的密码。我应该怎么做才能防止这种情况发生。我是否需要在 passport.js 之上添加类似 B crypt 的内容?因此密码不会暴露,chrome 不会发出此警告。

成功登录并重新路由到我的主页后出现错误,但我登录成功

路线


router.get("/main",isLoggedIn,function(req,res)
{
    res.render("main");
});
//Login logic
router.post("/signin", passport.authenticate("local",
    {
        successRedirect : "/main",
        failureRedirect : "/signup"
    }),function(req, res){
    
});

护照设置

//Setup passport
app.use(passport.initialize());
app.use(passport.session());
//Serialize user and deseriallize user allows for encoding and decoding
passport.serializeUser(User.serializeUser());
passport.deserializeUser(User.deserializeUser());
passport.use(new LocalStrategy(User.authenticate()));

我的登录表单进入路线:


<form action = "/signin" method="POST">
    <input type="text" name="username" placeholder="username">
    <input type="password" name="password" placeholder="password">
    <button>Sign in</button>
</form>

如果您还需要回答这个问题,请提出。

这是因为您使用的是基本密码进行测试。 Google 如果您使用一些基本密码进行测试,例如“test123”或 Chrome 中的任何内容,无论您的应用程序做什么,都会给您一个警告。

使用passport.js本地策略时不需要手动加密密码。