/** * @return The field value, if defined. * * @deprecated Deprecated as of 2.7.0. Method has been renamed to {@link #value()}. */ @Deprecated public Optional<String> getValue() { return value(); }
/** * @return The field value, if defined. * * @deprecated Deprecated as of 2.7.0. Method has been renamed to {@link #value()}. */ @Deprecated public Optional<String> getValue() { return value(); }
/** * @return The field value, if defined. * * @deprecated Deprecated as of 2.7.0. Method has been renamed to {@link #value()}. */ @Deprecated public Optional<String> getValue() { return value(); }
protected String extractEmail(Form<?> form) {return form.field(PasswordResetRequestData.EMAIL_FIELD).value();}
/** * Retrieves a field. * * @param key field name * @return the field - even if the field does not exist you get a field */ public Form.Field field(String key) { // #1310: We specify inner class as Form.Field rather than Field because otherwise, // javadoc cannot find the static inner class. Field field = super.field(asDynamicKey(key)); return new Field(this, key, field.constraints(), field.format(), field.errors(), field.value() == null ? get(key) : field.value() ); }
public Result signUpSuccessfulPage(Form<?> signUpForm) { flashInfo("signUpSuccess", "User activation email sent to '" + signUpForm.field(SignupData.EMAIL_FIELD).value() + "'."); return redirect(WelcomeController.welcome()); }
@Nullable protected String getSelectedCountry(final Form<?> form, final String fieldName) { return form.field(fieldName).value(); }
public Result resetPasswordRequestSuccessfulPage(Form<?> form) { FlashMessages.flashInfo(FLASH_PASSWORD_REQUEST_SENT, "An email with password reset instructions has been sent to '" + form.apply(PasswordResetRequestData.EMAIL_FIELD).value() + "'."); return redirect(WelcomeController.welcome()); }
@Nullable public static String extractFormField(@Nullable final Form<?> form, final String fieldName) { return form != null ? form.field(fieldName).value() : null; }
@Nullable protected String getSelectedTitle(final Form<?> form, final String fieldName) { return form.field(fieldName).value(); }
@Nullable protected String getSelectedMethodId(final Form<?> form, final String fieldName) { return form.field(fieldName).value(); } }
private Object resolveImpl(@Nonnull final Form<?> form, final String name) { if (name.equals("errors")) { return extractErrors(form); } else { final String value = form.field(name).value(); return isFalsy(value) ? false : firstNonNull(value, UNRESOLVED); } }
public boolean tryLogIn(Form<?> loginForm) { String email = loginForm.field(EMAIL_FIELD).value(); String password = loginForm.field(PASSWORD_FIELD).value(); PlessUser authenticatedUser = passwordAuthenticator().tryAuthenticateUser(email, password); if (authenticatedUser != null) { authenticationService().logIn(authenticatedUser); return true; } loginForm.reject(EMAIL_FIELD, "Login failed due to an incorrect email or password."); return false; }
/** * Retrieves a field. * * @param key field name * @return the field - even if the field does not exist you get a field */ public Field field(String key) { Field field = super.field(asDynamicKey(key)); return new Field(this, key, field.constraints(), field.format(), field.errors(), field.value() == null ? get(key) : field.value() ); }
@Override public Form.Field field(String key, Lang lang) { // #1310: We specify inner class as Form.Field rather than Field because otherwise, // javadoc cannot find the static inner class. Field field = super.field(asDynamicKey(key), lang); return new Field(this, key, field.constraints(), field.format(), field.errors(), field.value().orElse(value(key).map(v -> v instanceof String ? (String)v : null).orElse(null)), field.file().orElse(value(key).map(v -> v instanceof Http.MultipartFormData.FilePart ? (Http.MultipartFormData.FilePart)v : null).orElse(null)) ); }
@Override public Form.Field field(String key, Lang lang) { // #1310: We specify inner class as Form.Field rather than Field because otherwise, // javadoc cannot find the static inner class. Field field = super.field(asDynamicKey(key), lang); return new Field(this, key, field.constraints(), field.format(), field.errors(), field.value().orElse(value(key).map(v -> v instanceof String ? (String)v : null).orElse(null)), field.file().orElse(value(key).map(v -> v instanceof Http.MultipartFormData.FilePart ? (Http.MultipartFormData.FilePart)v : null).orElse(null)) ); }
@Nullable protected String getSelectedMethodId(final Form<?> form, final String fieldName) { return form.field(fieldName).value(); } }
@Override public Form.Field field(String key, Lang lang) { // #1310: We specify inner class as Form.Field rather than Field because otherwise, // javadoc cannot find the static inner class. Field field = super.field(asDynamicKey(key), lang); return new Field(this, key, field.constraints(), field.format(), field.errors(), field.value().orElse(value(key).map(v -> v instanceof String ? (String)v : null).orElse(null)), field.file().orElse(value(key).map(v -> v instanceof Http.MultipartFormData.FilePart ? (Http.MultipartFormData.FilePart)v : null).orElse(null)) ); }