0
양식 도우미에 어려움이 있습니다. 내가보기에 전달하기 전에 양식에 오류를 추가 할 수 있지만 다음과 같은 오류 얻을 :Play Framework : Form withGlobalError
value withGlobalError is not a member of play.api.data.Form[(String, String)]
다음과 내가 가진 코드가 될 때 :
def loginForm = Form(
tuple (
"email" -> nonEmptyText,
"password" -> nonEmptyText
)
)
def asignIn = Action {
implicit request =>
loginForm.bindFromRequest.fold (
formWithErrors => Ok(views.html.login(formWithErrors.withGlobalError("Invalid username or password")),
user => authenticationStep(user)(request)
)
}
왜냐하면 내가'authent'가 반환하는 객체에서'id'를 반환 할 수 없기 때문입니다. – Andrew
글쎄,'id'를 원하면'loginForm'에서 얻은 값을 사용하여'asignIn' 함수에서 얻을 수 있습니다. –
'asignIn'의'user'는 제 객체를 포함하고 있습니까? 내가 테스트 한 내용에는 터플 (이메일, 비밀번호)이 포함되어 있습니다. 당신이 나에게 그것을 제안하는 방식은 동일한 요청을 두 번해야합니다. – Andrew