这是调用路径“/ transaction-simulator”
的ejs表单 <form action="/transaction-simulator" method="post" class="form-theme">
<label>Enter your own OTP</label>
<input type="tel" id="realOTP" placeholder="Enter Your OTP" class="input" maxlength="6">
<input type="button" class="btn" value="Use OTP" onclick="compute()">
<label>Or</label>
<input type="button" class="btn" onclick="generate()" value="Tap to generate an OTP">
<label>Enter your Secret OTP</label>
<input type="text" id="resOTP" placeholder="Enter Your Secret OTP" class="input">
<input type="submit" class="btn" value="Verify" >
</form>
这是route.js中的路由,其中包含所有其他完美工作的路由,但此路由出现404错误。任何建议都会非常有用,并坚持了2天。
app.post("/transaction-simulator", isLoggedIn, function(req, res) {
var query = {
"_id": req.param.user_id
};
var projection = {
position: 1,
operation: 1,
userip: 1,
_id: 0
};
db.collection('users').findOne(query, projection, function(err, user) {
if (err) console.log("Error: " + JSON.stringify(err));
if (user) verifyOTP(user);
});
res.redirect("/profile");
});