Source:
<code>public final boolean login(final String user, final String pass, boolean requestTwoStep) { if (account != null) { throw new IllegalStateException("Already logged in."); } JSONObject result = null; if (!requestTwoStep) { try { BufferedReader contents = WebUtil.getReader(WebUtil.getConnection( new URL(Configuration.LOGIN_SERVER), URLEncoder.encode(user, "UTF-8"), URLEncoder.encode(pass, "UTF-8"))); result = (JSONObject) WebUtil.getJsonParser().parse(contents); } catch (Throwable t) { t.printStackTrace(); return false; } } else { try { String two = JOptionPane.showInputDialog("Please provide your two factor authentication code\nYou can find this in either your email or the app you've setup"); if (two != null && two.length() > 0) { String contents = WebUtil.getContents(Configuration.LOGIN_SERVER, "username=" + URLEncoder.encode(user, "UTF-8") + "&password=" + URLEncoder.encode(pass, "UTF-8") + "&2fa=" + URLEncoder.encode(two, "UTF-8") ); result = (JSONObject) WebUtil.getJsonParser().parse(contents); } } catch (Throwable t) { t.printStackTrace(); return false; } } if (result != null) { if (result.get("complete") != null) { String api = (String) ((JSONObject) result.get("data")).get("api"); account = new Account(user, pass, api); Context.setUsername(user); <START> new PBLocalPreferences("username.json").adjustSetting("username", user); <END> return true; } else if (result.get("error") != null) { String errorResult = (String) result.get("error"); if (errorResult.equals("2fa") || errorResult.equals("2fae")) { return login(user, pass, true); } Core.verbose(errorResult); return false; } } return false; }</code><technical_language>rename login.json</technical_language>

Target:
public final boolean login(final String user, final String pass, boolean requestTwoStep) { if (account != null) { throw new IllegalStateException("Already logged in."); } JSONObject result = null; if (!requestTwoStep) { try { BufferedReader contents = WebUtil.getReader(WebUtil.getConnection( new URL(Configuration.LOGIN_SERVER), URLEncoder.encode(user, "UTF-8"), URLEncoder.encode(pass, "UTF-8"))); result = (JSONObject) WebUtil.getJsonParser().parse(contents); } catch (Throwable t) { t.printStackTrace(); return false; } } else { try { String two = JOptionPane.showInputDialog("Please provide your two factor authentication code\nYou can find this in either your email or the app you've setup"); if (two != null && two.length() > 0) { String contents = WebUtil.getContents(Configuration.LOGIN_SERVER, "username=" + URLEncoder.encode(user, "UTF-8") + "&password=" + URLEncoder.encode(pass, "UTF-8") + "&2fa=" + URLEncoder.encode(two, "UTF-8") ); result = (JSONObject) WebUtil.getJsonParser().parse(contents); } } catch (Throwable t) { t.printStackTrace(); return false; } } if (result != null) { if (result.get("complete") != null) { String api = (String) ((JSONObject) result.get("data")).get("api"); account = new Account(user, pass, api); Context.setUsername(user); new PBLocalPreferences("login.json").adjustSetting("login", user); return true; } else if (result.get("error") != null) { String errorResult = (String) result.get("error"); if (errorResult.equals("2fa") || errorResult.equals("2fae")) { return login(user, pass, true); } Core.verbose(errorResult); return false; } } return false; }