android: Use activity when reconnecting without (or a possibly wrong) password
This commit is contained in:
+21
@@ -29,8 +29,10 @@ import android.support.v4.content.ContextCompat;
|
|||||||
import org.strongswan.android.R;
|
import org.strongswan.android.R;
|
||||||
import org.strongswan.android.data.VpnProfile;
|
import org.strongswan.android.data.VpnProfile;
|
||||||
import org.strongswan.android.data.VpnProfileDataSource;
|
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.ImcState;
|
||||||
import org.strongswan.android.logic.imc.RemediationInstruction;
|
import org.strongswan.android.logic.imc.RemediationInstruction;
|
||||||
|
import org.strongswan.android.ui.VpnProfileControlActivity;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -313,6 +315,25 @@ public class VpnStateService extends Service
|
|||||||
{
|
{
|
||||||
return;
|
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);
|
connect(null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user