From 713078d3348017dd8c229ee52701c2c1b69bd85d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Sat, 29 Jun 2013 13:01:07 +0200 Subject: Shows certificate error message. If a download didn't occurr due to an IOException, we assume it was for an SSL error and notify the user telling him/her that LEAP provider is not trusted. --- res/values/strings.xml | 3 ++- src/se/leap/leapclient/ProviderAPI.java | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 35b11b6..6f06ab6 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -292,7 +292,8 @@ Your anon cert has been correctly downloaded Your anon cert was not downloaded Server is down. - It doesn\'t seem to be a LEAP provider + It doesn\'t seem to be a LEAP provider. + This is not a trusted LEAP provider. Your password is not well-formed: it should have at least 8 characters. Authentication succeeded. Authentication failed. diff --git a/src/se/leap/leapclient/ProviderAPI.java b/src/se/leap/leapclient/ProviderAPI.java index b9cbdf2..1bc1149 100644 --- a/src/se/leap/leapclient/ProviderAPI.java +++ b/src/se/leap/leapclient/ProviderAPI.java @@ -371,7 +371,7 @@ public class ProviderAPI extends IntentService { if(provider_url != null && danger_on) { json_file_content = getStringFromProviderWithoutValidate(provider_url); } - displayToast(R.string.malformed_url); + displayToast(R.string.certificate_error); } catch (Exception e) { if(provider_url != null && danger_on) { json_file_content = getStringFromProviderWithoutValidate(provider_url); @@ -405,7 +405,7 @@ public class ProviderAPI extends IntentService { urlConnection.setHostnameVerifier(hostnameVerifier); json_string = new Scanner(urlConnection.getInputStream()).useDelimiter("\\A").next(); } catch (MalformedURLException e) { - Toast.makeText(getApplicationContext(), R.string.malformed_url, Toast.LENGTH_LONG).show(); + displayToast(R.string.malformed_url); } catch (IOException e) { json_string = getStringFromProviderWithCACertAdded(string_url); } @@ -469,7 +469,7 @@ public class ProviderAPI extends IntentService { } catch (IOException e) { // The downloaded certificate doesn't validate our https connection. json_file_content = getStringFromProviderIgnoringCertificate(url); - Toast.makeText(getApplicationContext(), R.string.malformed_url, Toast.LENGTH_LONG).show(); + displayToast(R.string.certificate_error); } catch (KeyStoreException e) { // TODO Auto-generated catch block e.printStackTrace(); -- cgit v1.2.3