|
@ -207,6 +207,8 @@ Builder.load_string(''' |
|
|
WizardTextInput: |
|
|
WizardTextInput: |
|
|
id: email |
|
|
id: email |
|
|
on_text: Clock.schedule_once(root.on_text) |
|
|
on_text: Clock.schedule_once(root.on_text) |
|
|
|
|
|
multiline: False |
|
|
|
|
|
on_text_validate: Clock.schedule_once(root.on_enter) |
|
|
|
|
|
|
|
|
<WizardKnownOTPDialog> |
|
|
<WizardKnownOTPDialog> |
|
|
message : '' |
|
|
message : '' |
|
@ -224,6 +226,8 @@ Builder.load_string(''' |
|
|
WizardTextInput: |
|
|
WizardTextInput: |
|
|
id: otp |
|
|
id: otp |
|
|
on_text: Clock.schedule_once(root.on_text) |
|
|
on_text: Clock.schedule_once(root.on_text) |
|
|
|
|
|
multiline: False |
|
|
|
|
|
on_text_validate: Clock.schedule_once(root.on_enter) |
|
|
Widget |
|
|
Widget |
|
|
size_hint: 1, 1 |
|
|
size_hint: 1, 1 |
|
|
Label: |
|
|
Label: |
|
@ -261,6 +265,8 @@ Builder.load_string(''' |
|
|
WizardTextInput: |
|
|
WizardTextInput: |
|
|
id: otp |
|
|
id: otp |
|
|
on_text: Clock.schedule_once(root.on_text) |
|
|
on_text: Clock.schedule_once(root.on_text) |
|
|
|
|
|
multiline: False |
|
|
|
|
|
on_text_validate: Clock.schedule_once(root.on_enter) |
|
|
|
|
|
|
|
|
<MButton@Button>: |
|
|
<MButton@Button>: |
|
|
size_hint: 1, None |
|
|
size_hint: 1, None |
|
@ -576,12 +582,8 @@ class WizardMultisigDialog(WizardDialog): |
|
|
n = self.ids.n.value |
|
|
n = self.ids.n.value |
|
|
return m, n |
|
|
return m, n |
|
|
|
|
|
|
|
|
class WizardKnownOTPDialog(WizardDialog): |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, wizard, **kwargs): |
|
|
class WizardOTPDialogBase(WizardDialog): |
|
|
WizardDialog.__init__(self, wizard, **kwargs) |
|
|
|
|
|
self.message = _("This wallet is already registered with TrustedCoin. To finalize wallet creation, please enter your Google Authenticator Code.") |
|
|
|
|
|
self.message2 =_("If you have lost your Google Authenticator account, check the box below to request a new secret. You will need to retype your seed.") |
|
|
|
|
|
|
|
|
|
|
|
def get_otp(self): |
|
|
def get_otp(self): |
|
|
otp = self.ids.otp.text |
|
|
otp = self.ids.otp.text |
|
@ -592,6 +594,23 @@ class WizardKnownOTPDialog(WizardDialog): |
|
|
except: |
|
|
except: |
|
|
return |
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
def on_text(self, dt): |
|
|
|
|
|
self.ids.next.disabled = self.get_otp() is None |
|
|
|
|
|
|
|
|
|
|
|
def on_enter(self, dt): |
|
|
|
|
|
# press next |
|
|
|
|
|
next = self.ids.next |
|
|
|
|
|
if not next.disabled: |
|
|
|
|
|
next.dispatch('on_release') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WizardKnownOTPDialog(WizardOTPDialogBase): |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, wizard, **kwargs): |
|
|
|
|
|
WizardOTPDialogBase.__init__(self, wizard, **kwargs) |
|
|
|
|
|
self.message = _("This wallet is already registered with TrustedCoin. To finalize wallet creation, please enter your Google Authenticator Code.") |
|
|
|
|
|
self.message2 =_("If you have lost your Google Authenticator account, check the box below to request a new secret. You will need to retype your seed.") |
|
|
|
|
|
|
|
|
def get_params(self, button): |
|
|
def get_params(self, button): |
|
|
return (self.get_otp(), self.ids.cb.active) |
|
|
return (self.get_otp(), self.ids.cb.active) |
|
|
|
|
|
|
|
@ -599,31 +618,17 @@ class WizardKnownOTPDialog(WizardDialog): |
|
|
self.ids.otp.text = '' |
|
|
self.ids.otp.text = '' |
|
|
self.ids.next.disabled = not self.ids.cb.active |
|
|
self.ids.next.disabled = not self.ids.cb.active |
|
|
|
|
|
|
|
|
def on_text(self, dt): |
|
|
|
|
|
self.ids.next.disabled = self.get_otp() is None |
|
|
|
|
|
|
|
|
|
|
|
class WizardNewOTPDialog(WizardDialog): |
|
|
class WizardNewOTPDialog(WizardOTPDialogBase): |
|
|
|
|
|
|
|
|
def __init__(self, wizard, **kwargs): |
|
|
def __init__(self, wizard, **kwargs): |
|
|
WizardDialog.__init__(self, wizard, **kwargs) |
|
|
WizardOTPDialogBase.__init__(self, wizard, **kwargs) |
|
|
otp_secret = kwargs['otp_secret'] |
|
|
otp_secret = kwargs['otp_secret'] |
|
|
uri = "otpauth://totp/%s?secret=%s"%('trustedcoin.com', otp_secret) |
|
|
uri = "otpauth://totp/%s?secret=%s"%('trustedcoin.com', otp_secret) |
|
|
self.message = "Please scan the following QR code in Google Authenticator. You may also use the secret key: %s"%otp_secret |
|
|
self.message = "Please scan the following QR code in Google Authenticator. You may also use the secret key: %s"%otp_secret |
|
|
self.message2 = _('Then, enter your Google Authenticator code:') |
|
|
self.message2 = _('Then, enter your Google Authenticator code:') |
|
|
self.ids.qr.set_data(uri) |
|
|
self.ids.qr.set_data(uri) |
|
|
|
|
|
|
|
|
def get_otp(self): |
|
|
|
|
|
otp = self.ids.otp.text |
|
|
|
|
|
if len(otp) != 6: |
|
|
|
|
|
return |
|
|
|
|
|
try: |
|
|
|
|
|
return int(otp) |
|
|
|
|
|
except: |
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
def on_text(self, dt): |
|
|
|
|
|
self.ids.next.disabled = self.get_otp() is None |
|
|
|
|
|
|
|
|
|
|
|
def get_params(self, button): |
|
|
def get_params(self, button): |
|
|
return (self.get_otp(), False) |
|
|
return (self.get_otp(), False) |
|
|
|
|
|
|
|
@ -637,11 +642,19 @@ class WizardTOSDialog(WizardDialog): |
|
|
self.message2 = _('Enter your email address:') |
|
|
self.message2 = _('Enter your email address:') |
|
|
|
|
|
|
|
|
class WizardEmailDialog(WizardDialog): |
|
|
class WizardEmailDialog(WizardDialog): |
|
|
|
|
|
|
|
|
def get_params(self, button): |
|
|
def get_params(self, button): |
|
|
return (self.ids.email.text,) |
|
|
return (self.ids.email.text,) |
|
|
|
|
|
|
|
|
def on_text(self, dt): |
|
|
def on_text(self, dt): |
|
|
self.ids.next.disabled = not is_valid_email(self.ids.email.text) |
|
|
self.ids.next.disabled = not is_valid_email(self.ids.email.text) |
|
|
|
|
|
|
|
|
|
|
|
def on_enter(self, dt): |
|
|
|
|
|
# press next |
|
|
|
|
|
next = self.ids.next |
|
|
|
|
|
if not next.disabled: |
|
|
|
|
|
next.dispatch('on_release') |
|
|
|
|
|
|
|
|
class WizardConfirmDialog(WizardDialog): |
|
|
class WizardConfirmDialog(WizardDialog): |
|
|
|
|
|
|
|
|
def __init__(self, wizard, **kwargs): |
|
|
def __init__(self, wizard, **kwargs): |
|
|