THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||
---|---|---|
| ||
public class Login
{
@Persist
@Property
private String userName;
@Property
private String password;
@Inject
private UserAuthenticator authenticator;
@InjectComponent(id = "password")
private PasswordField passwordField;
@Component
private Form form;
/**
* Do the cross-field validation
*/
void onValidateFromLoginForm()
{
if (!authenticator.isValid(userName, password))
{
// record an error, and thereby prevent Tapestry from emitting a "success" event
form.recordError(passwordField, "Invalid user name or password.");
}
}
/**
* Validation passed, so we'll go to the "PostLogin" page
*/
Object onSuccess()
{
return PostLogin.class;
}
}
|
...