summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkali <kali@leap.se>2013-02-14 06:07:36 +0900
committerkali <kali@leap.se>2013-02-14 06:07:36 +0900
commit2e21c3137b2a771a36ddb1e2e6c5a7a3f6f67b92 (patch)
tree36182f19384dc07d964a442e9f786da90f1bb329
parent7305cfdca8c74d30136cce1ba8becda555b9ab08 (diff)
Fix broken login page.
Close #1760
-rw-r--r--src/leap/eip/checks.py10
-rw-r--r--src/leap/gui/firstrun/login.py23
2 files changed, 19 insertions, 14 deletions
diff --git a/src/leap/eip/checks.py b/src/leap/eip/checks.py
index af824c57..52230db2 100644
--- a/src/leap/eip/checks.py
+++ b/src/leap/eip/checks.py
@@ -57,14 +57,15 @@ class ProviderCertChecker(object):
with provider.
"""
def __init__(self, fetcher=requests,
- domain=None):
+ domain=None,
+ apidomain=None):
self.fetcher = fetcher
self.domain = domain
#XXX needs some kind of autoinit
#right now we set by hand
#by loading and reading provider config
- self.apidomain = None
+ self.apidomain = apidomain
self.cacert = eipspecs.provider_ca_path(domain)
def run_all(
@@ -235,10 +236,9 @@ class ProviderCertChecker(object):
except requests.exceptions.SSLError:
logger.warning('SSLError while fetching cert. '
'Look below for stack trace.')
- # XXX raise better exception
- return self.fail("SSLError")
+ raise eipexceptions.HttpsBadCertError("SSLError")
except Exception as exc:
- return self.fail(exc.message)
+ raise eipexceptions.EIPClientError(exc.message)
try:
logger.debug('validating cert...')
diff --git a/src/leap/gui/firstrun/login.py b/src/leap/gui/firstrun/login.py
index 1efceaa9..409cb9bf 100644
--- a/src/leap/gui/firstrun/login.py
+++ b/src/leap/gui/firstrun/login.py
@@ -1,6 +1,8 @@
"""
LogIn Page, used inf First Run Wizard
"""
+import logging
+
from PyQt4 import QtCore
from PyQt4 import QtGui
@@ -13,6 +15,8 @@ from leap.gui import styles
from leap.gui.constants import APP_LOGO, APP_WATERMARK, FULL_USERNAME_REGEX
+logger = logging.getLogger(__name__)
+
class LogInPage(InlineValidationPage, UserFormMixIn): # InlineValidationPage
@@ -112,7 +116,9 @@ class LogInPage(InlineValidationPage, UserFormMixIn): # InlineValidationPage
# page here as a mean to catch
# srp authentication errors while
wizard = self.wizard()
- eipconfigchecker = wizard.eipconfigchecker(domain=domain)
+ pconfig = wizard.eipconfigchecker(domain=domain)
+ pconfig.defaultprovider.load()
+ pconfig.set_api_domain()
########################
# 1) try name resolution
@@ -126,7 +132,7 @@ class LogInPage(InlineValidationPage, UserFormMixIn): # InlineValidationPage
# two-by-one
def resolvedomain():
try:
- eipconfigchecker.fetch_definition(domain=domain)
+ pconfig.fetch_definition(domain=domain)
# we're using requests here for all
# the possible error cases that it catches.
@@ -144,30 +150,29 @@ class LogInPage(InlineValidationPage, UserFormMixIn): # InlineValidationPage
yield((self.tr("Resolving domain name"), 20), resolvedomain)
wizard.set_providerconfig(
- eipconfigchecker.defaultprovider.config)
+ pconfig.defaultprovider.config)
########################
# 2) do authentication
########################
credentials = username, password
pCertChecker = wizard.providercertchecker(
- domain=domain)
+ domain=domain,
+ apidomain=pconfig.get_api_domain())
def validate_credentials():
- #################
- # FIXME #BUG #638
- verify = False
try:
pCertChecker.download_new_client_cert(
- credentials=credentials,
- verify=verify)
+ credentials=credentials)
except auth.SRPAuthenticationError as exc:
+ logger.debug('srp auth error in validate credentials step')
return self.fail(
self.tr("Authentication error: %s" % exc.message))
except Exception as exc:
+ logger.error('unknown error in validate credentials step')
return self.fail(exc.message)
else: