Un ami DJ m'a dit qu'on pouvait tout modifier avec photoshop

public boolean authenticate(String login, String password) throws AuthenticationFailed {
Preconditions.checkNotNull(login, "login is mandatory");
Preconditions.checkNotNull(password, "password is mandatory");
this.login = login;
this.password = password;
try {
WebClient webClient = new WebClient();
HtmlPage loginPage = (HtmlPage) webClient.getPage("http://www.neogeofans.com/leforum/index.php");
HtmlForm loginForm = fillForm(loginPage);
String contentResult = submitForm(loginForm);
return contentResult.contains("Merci de vous être identifié, " + login + ".");
} catch (IOException e) {
throw new AuthenticationFailed(e);
}
}
private String submitForm(HtmlForm loginForm) throws IOException {
HtmlSubmitInput submitButton = (HtmlSubmitInput) loginForm.getInputByValue("S'identifier");
HtmlPage resultPage = (HtmlPage) submitButton.click();
String contentResult = resultPage.asText();
return contentResult;
}
private HtmlForm fillForm(HtmlPage loginPage) {
HtmlForm loginForm = (HtmlForm) loginPage.getForms().get(0);
passwordTextfield = (HtmlPasswordInput) loginForm.getInputByName("vb_login_password");
passwordTextfield.setValueAttribute(password);
loginTextfield = (HtmlTextInput) loginForm.getInputByName("vb_login_username");
loginTextfield.setValueAttribute(login);
return loginForm;
}

Commentaire