사용자가 비밀번호를 재설정 할 수있는 스크립트를 작성 중입니다. 사용자가 해당 링크를 클릭 할 때nodejs의 비밀번호 재설정
사용자
같은 이메일을 받게됩니다. 양식이 으로 열리고 사용자가 새 암호를 입력 할 수 있습니다. 이 내 경로 코드
app.get('/resetpassword/:token', function (req, res, next) {
var fileLocation = path.resolve(__dirname + '/../public/resetpassword.html');
console.log(fileLocation);
res.sendfile(fileLocation);
});
app.post('/setnewpassword', function(req,res,next){
console.dir(req.body);
});
하고 내 HTML은
<form action="/setnewpassword" method="POST">
<div>
<label>Password:</label>
<input type="password" name="password" />
</div>
<input type="submit" value="Submit" />
</form>
이제 문제는 내가 (app.post에서 '/ setnewpassword'
어떤을 PARAMS을받지 오전이있다 아이디어? setnewpassword에서 매개 변수를 얻는 방법
POST 메서드 만 사용하고 싶습니다.
당신이 구문 분석 bodyparser를 사용에 POST PARAMS는? – aega
그것을 사용하는 방법. 난 아무 생각이 –
더 아부를 알려 귀하의 코드, 당신은 표현을 사용하고 있습니까? 브라우저에서 요청을 확인 했습니까? 그것의 params 일부입니까? 예인 경우 req의 헤더는 무엇입니까? 응용 프로그램/json입니까? – 1Mayur