From: Tobias Brunner Date: Wed, 20 Jun 2018 10:25:09 +0000 (+0200) Subject: android: Use activity when reconnecting without (or a possibly wrong) password X-Git-Tag: 5.7.0dr5~20^2~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3eda52f039154f851488b8233f3cf50cc1304eda;p=thirdparty%2Fstrongswan.git android: Use activity when reconnecting without (or a possibly wrong) password --- diff --git a/src/frontends/android/app/src/main/java/org/strongswan/android/logic/VpnStateService.java b/src/frontends/android/app/src/main/java/org/strongswan/android/logic/VpnStateService.java index 9fd5a42d75..4be782640b 100644 --- a/src/frontends/android/app/src/main/java/org/strongswan/android/logic/VpnStateService.java +++ b/src/frontends/android/app/src/main/java/org/strongswan/android/logic/VpnStateService.java @@ -29,8 +29,10 @@ import android.support.v4.content.ContextCompat; import org.strongswan.android.R; import org.strongswan.android.data.VpnProfile; import org.strongswan.android.data.VpnProfileDataSource; +import org.strongswan.android.data.VpnType; import org.strongswan.android.logic.imc.ImcState; import org.strongswan.android.logic.imc.RemediationInstruction; +import org.strongswan.android.ui.VpnProfileControlActivity; import java.lang.ref.WeakReference; import java.util.Collections; @@ -313,6 +315,25 @@ public class VpnStateService extends Service { return; } + if (mProfile.getVpnType().has(VpnType.VpnTypeFeature.USER_PASS)) + { + if (mProfile.getPassword() == null || + mError == ErrorState.AUTH_FAILED) + { /* show a dialog if we either don't have the password or if it might be the wrong + * one (which is or isn't stored with the profile, let the activity decide) */ + Intent intent = new Intent(this, VpnProfileControlActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.setAction(VpnProfileControlActivity.START_PROFILE); + intent.putExtra(VpnProfileControlActivity.EXTRA_VPN_PROFILE_ID, mProfile.getUUID().toString()); + startActivity(intent); + /* reset the retry timer immediately in case the user needs more time to enter the password */ + notifyListeners(() -> { + resetRetryTimer(); + return true; + }); + return; + } + } connect(null, true); }