diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-11-04 11:18:41 +0100 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-11-04 11:18:41 +0100 |
commit | 80bd189eb492a35ed5d30b8acf77603f64613749 (patch) | |
tree | 0cfeadf48786fd85cc404b764a14d1adf49841c9 /pdf-over-gui/src/main/java | |
parent | 97ade449dd0ba0f0b9577de325b771ff433f0a74 (diff) | |
download | pdf-over-80bd189eb492a35ed5d30b8acf77603f64613749.tar.gz pdf-over-80bd189eb492a35ed5d30b8acf77603f64613749.tar.bz2 pdf-over-80bd189eb492a35ed5d30b8acf77603f64613749.zip |
clear remembered username/password when disabling remember
Diffstat (limited to 'pdf-over-gui/src/main/java')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java index 92dca222..e1ecf39c 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java @@ -263,6 +263,19 @@ public class MobileBKUState extends State { return r;
}
+ private void updateRememberPasswordSetting(boolean enabled, boolean allowEnabling) {
+ final var config = getStateMachine().configProvider;
+ if (enabled == config.getRememberMobilePassword()) /* nothing to do here */
+ return;
+ if (enabled && !allowEnabling) /* do not allow "cancel" to set the remember checkbox */
+ return;
+ config.setRememberMobilePasswordPersistent(enabled);
+ if (!enabled) { /* clear remembered info */
+ config.setDefaultMobileNumberPersistent(null);
+ config.setDefaultMobilePasswordOverlay(null);
+ }
+ }
+
public void getCredentialsFromUserTo(@Nonnull UsernameAndPassword credentials, @Nullable String errorMessage) throws UserCancelledException {
Display.getDefault().syncCall(() -> {
MobileBKUEnterNumberComposite ui = this.getMobileBKUEnterNumberComposite();
@@ -292,8 +305,7 @@ public class MobileBKUState extends State { }
}
- if (!(ui.userCancel && ui.isRememberPassword())) /* don't allow "remember" to be enabled via cancel button */
- getStateMachine().configProvider.setRememberMobilePasswordPersistent(ui.isRememberPassword());
+ updateRememberPasswordSetting(ui.isRememberPassword(), !ui.userCancel);
if (ui.userCancel) {
ui.userCancel = false;
|