forked from j62/ctbrec
Logout and delete cookies when credentials are changed
This commit is contained in:
parent
04382dfa6e
commit
bb3de83453
|
@ -47,8 +47,11 @@ public class BongaCamsConfigUI extends AbstractConfigUI {
|
|||
layout.add(new Label("BongaCams User"), 0, row);
|
||||
TextField username = new TextField(settings.bongaUsername);
|
||||
username.textProperty().addListener((ob, o, n) -> {
|
||||
settings.bongaUsername = username.getText();
|
||||
if(!n.equals(Config.getInstance().getSettings().bongaUsername)) {
|
||||
Config.getInstance().getSettings().bongaUsername = username.getText();
|
||||
bongaCams.getHttpClient().logout();
|
||||
save();
|
||||
}
|
||||
});
|
||||
GridPane.setFillWidth(username, true);
|
||||
GridPane.setHgrow(username, Priority.ALWAYS);
|
||||
|
@ -58,9 +61,12 @@ public class BongaCamsConfigUI extends AbstractConfigUI {
|
|||
layout.add(new Label("BongaCams Password"), 0, row);
|
||||
PasswordField password = new PasswordField();
|
||||
password.setText(settings.bongaPassword);
|
||||
password.focusedProperty().addListener((e) -> {
|
||||
settings.bongaPassword = password.getText();
|
||||
password.textProperty().addListener((ob, o, n) -> {
|
||||
if(!n.equals(Config.getInstance().getSettings().bongaPassword)) {
|
||||
Config.getInstance().getSettings().bongaPassword = password.getText();
|
||||
bongaCams.getHttpClient().logout();
|
||||
save();
|
||||
}
|
||||
});
|
||||
GridPane.setFillWidth(password, true);
|
||||
GridPane.setHgrow(password, Priority.ALWAYS);
|
||||
|
|
|
@ -47,8 +47,11 @@ public class Cam4ConfigUI extends AbstractConfigUI {
|
|||
layout.add(new Label("Cam4 User"), 0, row);
|
||||
TextField username = new TextField(Config.getInstance().getSettings().cam4Username);
|
||||
username.textProperty().addListener((ob, o, n) -> {
|
||||
if(!n.equals(Config.getInstance().getSettings().cam4Username)) {
|
||||
Config.getInstance().getSettings().cam4Username = username.getText();
|
||||
cam4.getHttpClient().logout();
|
||||
save();
|
||||
}
|
||||
});
|
||||
GridPane.setFillWidth(username, true);
|
||||
GridPane.setHgrow(username, Priority.ALWAYS);
|
||||
|
@ -58,9 +61,12 @@ public class Cam4ConfigUI extends AbstractConfigUI {
|
|||
layout.add(new Label("Cam4 Password"), 0, row);
|
||||
PasswordField password = new PasswordField();
|
||||
password.setText(Config.getInstance().getSettings().cam4Password);
|
||||
password.focusedProperty().addListener((e) -> {
|
||||
password.textProperty().addListener((ob, o, n) -> {
|
||||
if(!n.equals(Config.getInstance().getSettings().cam4Password)) {
|
||||
Config.getInstance().getSettings().cam4Password = password.getText();
|
||||
cam4.getHttpClient().logout();
|
||||
save();
|
||||
}
|
||||
});
|
||||
GridPane.setFillWidth(password, true);
|
||||
GridPane.setHgrow(password, Priority.ALWAYS);
|
||||
|
|
|
@ -47,8 +47,11 @@ public class CamsodaConfigUI extends AbstractConfigUI {
|
|||
layout.add(new Label("CamSoda User"), 0, row);
|
||||
TextField username = new TextField(Config.getInstance().getSettings().camsodaUsername);
|
||||
username.textProperty().addListener((ob, o, n) -> {
|
||||
if(!n.equals(Config.getInstance().getSettings().camsodaUsername)) {
|
||||
Config.getInstance().getSettings().camsodaUsername = username.getText();
|
||||
camsoda.getHttpClient().logout();
|
||||
save();
|
||||
}
|
||||
});
|
||||
GridPane.setFillWidth(username, true);
|
||||
GridPane.setHgrow(username, Priority.ALWAYS);
|
||||
|
@ -59,8 +62,11 @@ public class CamsodaConfigUI extends AbstractConfigUI {
|
|||
PasswordField password = new PasswordField();
|
||||
password.setText(Config.getInstance().getSettings().camsodaPassword);
|
||||
password.textProperty().addListener((ob, o, n) -> {
|
||||
if(!n.equals(Config.getInstance().getSettings().camsodaPassword)) {
|
||||
Config.getInstance().getSettings().camsodaPassword = password.getText();
|
||||
camsoda.getHttpClient().logout();
|
||||
save();
|
||||
}
|
||||
});
|
||||
GridPane.setFillWidth(password, true);
|
||||
GridPane.setHgrow(password, Priority.ALWAYS);
|
||||
|
|
|
@ -47,8 +47,11 @@ public class ChaturbateConfigUi extends AbstractConfigUI {
|
|||
layout.add(new Label("Chaturbate User"), 0, row);
|
||||
TextField username = new TextField(Config.getInstance().getSettings().username);
|
||||
username.textProperty().addListener((ob, o, n) -> {
|
||||
Config.getInstance().getSettings().username = username.getText();
|
||||
if(!n.equals(Config.getInstance().getSettings().username)) {
|
||||
Config.getInstance().getSettings().username = n;
|
||||
chaturbate.getHttpClient().logout();
|
||||
save();
|
||||
}
|
||||
});
|
||||
GridPane.setFillWidth(username, true);
|
||||
GridPane.setHgrow(username, Priority.ALWAYS);
|
||||
|
@ -59,8 +62,11 @@ public class ChaturbateConfigUi extends AbstractConfigUI {
|
|||
PasswordField password = new PasswordField();
|
||||
password.setText(Config.getInstance().getSettings().password);
|
||||
password.textProperty().addListener((ob, o, n) -> {
|
||||
Config.getInstance().getSettings().password = password.getText();
|
||||
if(!n.equals(Config.getInstance().getSettings().password)) {
|
||||
Config.getInstance().getSettings().password = n;
|
||||
chaturbate.getHttpClient().logout();
|
||||
save();
|
||||
}
|
||||
});
|
||||
GridPane.setFillWidth(password, true);
|
||||
GridPane.setHgrow(password, Priority.ALWAYS);
|
||||
|
|
|
@ -48,8 +48,11 @@ public class MyFreeCamsConfigUI extends AbstractConfigUI {
|
|||
TextField username = new TextField(Config.getInstance().getSettings().mfcUsername);
|
||||
username.setPrefWidth(300);
|
||||
username.textProperty().addListener((ob, o, n) -> {
|
||||
if(!n.equals(Config.getInstance().getSettings().mfcUsername)) {
|
||||
Config.getInstance().getSettings().mfcUsername = username.getText();
|
||||
myFreeCams.getHttpClient().logout();
|
||||
save();
|
||||
}
|
||||
});
|
||||
GridPane.setFillWidth(username, true);
|
||||
GridPane.setHgrow(username, Priority.ALWAYS);
|
||||
|
@ -60,8 +63,11 @@ public class MyFreeCamsConfigUI extends AbstractConfigUI {
|
|||
PasswordField password = new PasswordField();
|
||||
password.setText(Config.getInstance().getSettings().mfcPassword);
|
||||
password.textProperty().addListener((ob, o, n) -> {
|
||||
if(!n.equals(Config.getInstance().getSettings().mfcPassword)) {
|
||||
Config.getInstance().getSettings().mfcPassword = password.getText();
|
||||
myFreeCams.getHttpClient().logout();
|
||||
save();
|
||||
}
|
||||
});
|
||||
GridPane.setFillWidth(password, true);
|
||||
GridPane.setHgrow(password, Priority.ALWAYS);
|
||||
|
|
|
@ -92,4 +92,8 @@ public class CookieJarImpl implements CookieJar {
|
|||
public Map<String, List<Cookie>> getCookies() {
|
||||
return cookieStore;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
cookieStore.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import ctbrec.Config;
|
|||
import ctbrec.Settings.ProxyType;
|
||||
import okhttp3.ConnectionPool;
|
||||
import okhttp3.Cookie;
|
||||
import okhttp3.CookieJar;
|
||||
import okhttp3.Credentials;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.OkHttpClient.Builder;
|
||||
|
@ -212,7 +211,12 @@ public abstract class HttpClient {
|
|||
}
|
||||
}
|
||||
|
||||
public CookieJar getCookieJar() {
|
||||
public CookieJarImpl getCookieJar() {
|
||||
return cookieJar;
|
||||
}
|
||||
|
||||
public void logout() {
|
||||
getCookieJar().clear();
|
||||
loggedIn = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue