암호 재설정을 구현하려고하는데 오류가 발생하지만 실제로 무엇을 잘못하고 있는지 이해할 수 없습니다.Play Framework 2 양식에서 데이터를 가져올 수 없습니다.
이 변경 암호 클래스입니다 : 재설정 암호 클래스에 의해 확장
public static class PasswordChange {
@MinLength(6)
@Required
public String password;
@MinLength(6)
@Required
public String repeatPasssword;
public String getPassword() {
return password;
}
public String getRepeatPasssword() {
return repeatPasssword;
}
public void setRepeatPasssword(String repeatPasssword) {
this.repeatPasssword = repeatPasssword;
}
public void setPassword(String password) {
this.password = password;
}
public String validate() {
if (password == null || !password.equals(repeatPasssword)) {
return Messages.get("auth.change_password.error.passwords_not_same");
}
return null;
}
}
: 내가 얻을 submittion 후
@(resetForm: Form[controllers.Signup.PasswordReset])
@import helper._
@import helper.twitterBootstrap._
@main(Messages("auth.password.forgot.title")){
<p>
@form(routes.Signup.doResetPassword()) {
@if(resetForm.hasGlobalErrors) {
<p class="error">
<span class="label label-important">@resetForm.globalError.message</span>
</p>
}
@views.html.auth.account.signup._passwordPartial(resetForm)
<input type="hidden" name="token" id="token" value='@resetForm("token").value' />
<input type="submit" value="@Messages("auth.change.password.cta")" class="btn btn-primary">
}
</p>
}{ }
:
public static class PasswordReset extends Account.PasswordChange {
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String token;
public PasswordReset() {}
public PasswordReset(final String token) {
this.token = token;
}
}
이것은 내 양식입니다 컨트롤러의 양식 :
final Form<PasswordReset> filledForm = PASSWORD_RESET_FORM.bindFromRequest(request());
PASSWORD_RESET_FORM는 동일한 컨트롤러에 선언 된 필드 :
private static final Form<PasswordReset> PASSWORD_RESET_FORM = form(PasswordReset.class);
그리고이 결과 : 분명히
Form(of=class controllers.Signup$PasswordReset,
data={token=e2d48b70-9d00-4b8f-a8e4-ee17089c4e22,
repeatPassword=1234567, password=1234567},
value=None,
errors={repeatPasssword=[ValidationError(repeatPasssword,error.required,[])]})
, filledForm.hasErrors()가 true를 돌려 그리고 난 (때문에 아무것도 얻을 수 없다 값 = 없음). 누구든지 내 실수로 나를 가리킬 수 있습니까?
UPD는 : views.html.auth.account.signup._passwordPartial (resetForm)는 암호와 암호에 대한 템플릿입니다 @ 필드
@(f: Form[_])
@import helper._
@import helper.twitterBootstrap._
@inputPassword(
f("password"),
'_label -> Messages("auth.password.placeholder")
)
@inputPassword(
f("repeatPassword"),
'_label -> Messages("auth.password.repeat"),
'_showConstraints -> false,
'_error -> f.error("password")
)
이 뷰는'@ views.html.auth.account.signup._passwordPartial (resetForm)'에 무엇이 있습니까? –
새 암호 및 암호 확인 필드의 템플릿입니다. 내 질문을 업데이트했습니다. 소스를 볼 수 있습니다. – MightySeal
질문을 편집하여 문제를 해결할 수 있습니까? –