summaryrefslogtreecommitdiff
path: root/src/leap/gui/firstrun/regvalidation.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-11-27 00:12:22 +0900
committerkali <kali@leap.se>2012-11-27 00:43:01 +0900
commitd5136a5f3b2aa8b16e8341f2eb99d05993028acf (patch)
tree7ef847e02cb9d60fb38761d0001f41968ea5a23f /src/leap/gui/firstrun/regvalidation.py
parent7a263b8ee74cc92ba39796cd9ad48395adfa7450 (diff)
inline validation at register page.
inline widget and focus and red marks and whistles.
Diffstat (limited to 'src/leap/gui/firstrun/regvalidation.py')
-rw-r--r--src/leap/gui/firstrun/regvalidation.py80
1 files changed, 36 insertions, 44 deletions
diff --git a/src/leap/gui/firstrun/regvalidation.py b/src/leap/gui/firstrun/regvalidation.py
index 79971944..0e67834b 100644
--- a/src/leap/gui/firstrun/regvalidation.py
+++ b/src/leap/gui/firstrun/regvalidation.py
@@ -9,12 +9,12 @@ used in First Run Wizard
# the login branch of the wizard.
import logging
-import json
-import socket
+#import json
+#import socket
from PyQt4 import QtGui
-import requests
+#import requests
from leap.gui.progress import ValidationPage
from leap.util.web import get_https_domain_and_port
@@ -77,67 +77,59 @@ class RegisterUserValidationPage(ValidationPage):
pCertChecker = wizard.providercertchecker(
domain=full_domain)
- update_signal.emit("head_sentinel", 0)
+ yield(("head_sentinel", 0), lambda: None)
##################################################
- # 2) fetching eip service config
+ # 1) fetching eip service config
##################################################
+ def fetcheipconf():
+ try:
+ eipconfigchecker.fetch_eip_service_config(
+ domain=full_domain)
- step = "fetch_eipconf"
- fetching_eipconf_msg = "Fetching eip service configuration"
- update_signal.emit(fetching_eipconf_msg, 60)
- try:
- eipconfigchecker.fetch_eip_service_config(
- domain=full_domain)
-
- # XXX get specific exception
- except:
- self.set_error(
- step,
- 'Could not download eip config.')
- #pause_for_user()
- return False
- #pause_for_user()
+ # XXX get specific exception
+ except Exception as exc:
+ return self.fail(exc.message)
+
+ yield((self.tr("Fetching provider config..."), 40),
+ fetcheipconf)
##################################################
- # 3) getting client certificate
+ # 2) getting client certificate
##################################################
- # XXX maybe only do this if we come from signup
-
- step = "fetch_eipcert"
- fetching_clientcert_msg = "Fetching eip certificate"
- update_signal.emit(fetching_clientcert_msg, 80)
- try:
- pCertChecker.download_new_client_cert(
- credentials=credentials,
- verify=verify)
+ def fetcheipcert():
+ try:
+ pCertChecker.download_new_client_cert(
+ credentials=credentials,
+ verify=verify)
- except auth.SRPAuthenticationError as exc:
- self.set_error(
- step,
- "Authentication error: %s" % exc.message)
- return False
+ except auth.SRPAuthenticationError as exc:
+ return self.fail(self.tr(
+ "Authentication error: %s" % exc.message))
+ else:
+ return True
- #pause_for_user()
+ yield((self.tr("Fetching eip certificate"), 80),
+ fetcheipcert)
################
# end !
################
-
- update_signal.emit("end_sentinel", 100)
- #pause_for_user()
-
- # here we go! :)
- # this should be called CONNECT PAGE AGAIN.
- self.run_eip_checks_for_provider_and_connect(_domain)
+ self.set_done()
+ yield(("end_sentinel", 100), lambda: None)
def on_checks_validation_ready(self):
"""
called after _do_checks has finished
(connected to checker thread finished signal)
"""
- pass
+ # this should be called CONNECT PAGE AGAIN.
+ # here we go! :)
+ full_domain = self.field('provider_domain')
+ domain, port = get_https_domain_and_port(full_domain)
+ _domain = u"%s:%s" % (domain, port) if port != 443 else unicode(domain)
+ self.run_eip_checks_for_provider_and_connect(_domain)
def run_eip_checks_for_provider_and_connect(self, domain):
wizard = self.wizard()