Archived
0

don't save login in field

This commit is contained in:
Mo
2015-07-19 12:47:33 +03:00
committed by iMoHax
parent 37e147055f
commit 0ab1490d1c
2 changed files with 7 additions and 9 deletions

View File

@@ -32,15 +32,11 @@ public class EDSession {
private final static String USER_AGENT = "Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Mobile/11D257";
private final static String COOKIE_FILE = "edce.tmp";
private final String login;
private final String password;
private CookieStore cookieStore;
private CloseableHttpClient httpClient;
private ED_SESSION_STATUS lastStatus;
public EDSession(String login, String password) throws IOException, ClassNotFoundException {
this.login = login;
this.password = password;
public EDSession() throws IOException, ClassNotFoundException {
this.lastStatus = ED_SESSION_STATUS.LOGIN_REQUIRED;
initClient();
}
@@ -55,7 +51,7 @@ public class EDSession {
.build();
}
public void login(){
public void login(String login, String password){
LOG.info("Login to {}, email {}", COMPANION_DOMAIN, login);
HttpUriRequest loginRequest = RequestBuilder.post(LOGIN_URL)
.addParameter("email", login)

View File

@@ -22,18 +22,20 @@ public class EDSessionDemo {
public static void main(String args[]) throws Exception {
LOG.info("Test ED Companion connect");
EDSession edSession = new EDSession("frontier@mail.ru","elite");
EDSession edSession = new EDSession();
if (edSession.getLastStatus() == ED_SESSION_STATUS.OK){
LOG.info("Check get profile");
edSession.readProfile(s ->{});
}
if (edSession.getLastStatus() == ED_SESSION_STATUS.LOGIN_REQUIRED) {
edSession.login();
String login = readLine("Login:");
String pass = readLine("Password:");
edSession.login(login, pass);
if (edSession.getLastStatus() == ED_SESSION_STATUS.VERIFICATION_REQUIRED) {
LOG.info("Check verification");
String code = readLine("Verify code:");
edSession.submitVerifyCode(code);
edSession.login();
edSession.login(login, pass);
}
if (edSession.getLastStatus() == ED_SESSION_STATUS.OK) {
LOG.info("Check get profile");