Exemple #1
0
    def setup_google_auth(self, window, _id, otp_secret):
        uri = "otpauth://totp/%s?secret=%s" % ('trustedcoin.com', otp_secret)
        vbox = QVBoxLayout()
        window.set_layout(vbox)
        vbox.addWidget(
            QLabel("Please scan this QR code in Google Authenticator."))
        qrw = QRCodeWidget(uri)
        vbox.addWidget(qrw, 1)
        #vbox.addWidget(QLabel(data), 0, Qt.AlignHCenter)

        hbox = QHBoxLayout()
        msg = _('Then, enter your Google Authenticator code:')
        hbox.addWidget(QLabel(msg))
        pw = AmountEdit(None, is_int=True)
        pw.setFocus(True)
        hbox.addWidget(pw)
        hbox.addStretch(1)
        vbox.addLayout(hbox)

        hbox, b = ok_cancel_buttons2(window, _('Next'))
        b.setEnabled(False)
        vbox.addLayout(hbox)
        pw.textChanged.connect(lambda: b.setEnabled(len(pw.text()) == 6))

        window.exec_()
        otp = pw.get_amount()
        try:
            server.auth(_id, otp)
        except:
            self.window.show_message('Incorrect password, aborting')
            return

        return True
Exemple #2
0
    def setup_google_auth(self, window, _id, otp_secret):
        uri = "otpauth://totp/%s?secret=%s"%('trustedcoin.com', otp_secret)
        vbox = QVBoxLayout()
        window.set_layout(vbox)
        vbox.addWidget(QLabel("Please scan this QR code in Google Authenticator."))
        qrw = QRCodeWidget(uri)
        vbox.addWidget(qrw, 1)
        #vbox.addWidget(QLabel(data), 0, Qt.AlignHCenter)

        hbox = QHBoxLayout()
        msg = _('Then, enter your Google Authenticator code:')
        hbox.addWidget(QLabel(msg))
        pw = AmountEdit(None, is_int = True)
        pw.setFocus(True)
        hbox.addWidget(pw)
        hbox.addStretch(1)
        vbox.addLayout(hbox)

        hbox, b = ok_cancel_buttons2(window, _('Next'))
        b.setEnabled(False)
        vbox.addLayout(hbox)
        pw.textChanged.connect(lambda: b.setEnabled(len(pw.text())==6))

        window.exec_()
        otp = pw.get_amount()
        try:
            server.auth(_id, otp)
        except:
            self.window.show_message('Incorrect password, aborting')
            return

        return True
Exemple #3
0
    def request_otp_dialog(self, window, _id, otp_secret):
        vbox = QVBoxLayout()
        if otp_secret is not None:
            uri = "otpauth://totp/%s?secret=%s" % ('trustedcoin.com',
                                                   otp_secret)
            l = QLabel(
                "Please scan the following QR code in Google Authenticator. You may as well use the following key: %s"
                % otp_secret)
            l.setWordWrap(True)
            vbox.addWidget(l)
            qrw = QRCodeWidget(uri)
            vbox.addWidget(qrw, 1)
            msg = _('Then, enter your Google Authenticator code:')
        else:
            label = QLabel(
                "This wallet is already registered with Trustedcoin. "
                "To finalize wallet creation, please enter your Google Authenticator Code. "
            )
            label.setWordWrap(1)
            vbox.addWidget(label)
            msg = _('Google Authenticator code:')

        hbox = QHBoxLayout()
        hbox.addWidget(WWLabel(msg))
        pw = AmountEdit(None, is_int=True)
        pw.setFocus(True)
        pw.setMaximumWidth(50)
        hbox.addWidget(pw)
        vbox.addLayout(hbox)

        cb_lost = QCheckBox(_("I have lost my Google Authenticator account"))
        cb_lost.setToolTip(
            _("Check this box to request a new secret. You will need to retype your seed."
              ))
        vbox.addWidget(cb_lost)
        cb_lost.setVisible(otp_secret is None)

        def set_enabled():
            b = True if cb_lost.isChecked() else len(pw.text()) == 6
            window.next_button.setEnabled(b)

        pw.textChanged.connect(set_enabled)
        cb_lost.toggled.connect(set_enabled)

        window.exec_layout(vbox, next_enabled=False, raise_on_cancel=False)
        return pw.get_amount(), cb_lost.isChecked()
Exemple #4
0
    def setup_google_auth(self, window, _id, otp_secret):
        vbox = QVBoxLayout()
        if otp_secret is not None:
            uri = "otpauth://totp/%s?secret=%s" % ('trustedcoin.com',
                                                   otp_secret)
            l = QLabel(
                "Please scan the following QR code in Google Authenticator. You may as well use the following key: %s"
                % otp_secret)
            l.setWordWrap(True)
            vbox.addWidget(l)
            qrw = QRCodeWidget(uri)
            vbox.addWidget(qrw, 1)
            msg = _('Then, enter your Google Authenticator code:')
        else:
            label = QLabel(
                "This wallet is already registered, but it was never authenticated. To finalize your registration, please enter your Google Authenticator Code. If you do not have this code, delete the wallet file and start a new registration"
            )
            label.setWordWrap(1)
            vbox.addWidget(label)
            msg = _('Google Authenticator code:')

        hbox = QHBoxLayout()
        hbox.addWidget(WWLabel(msg))
        pw = AmountEdit(None, is_int=True)
        pw.setFocus(True)
        pw.setMaximumWidth(50)
        hbox.addWidget(pw)
        vbox.addLayout(hbox)

        def set_enabled():
            window.next_button.setEnabled(len(pw.text()) == 6)

        pw.textChanged.connect(set_enabled)

        while True:
            if not window.set_main_layout(
                    vbox, next_enabled=False, raise_on_cancel=False):
                return False
            otp = pw.get_amount()
            try:
                server.auth(_id, otp)
                return True
            except:
                window.show_message(_('Incorrect password'))
                pw.setText('')
Exemple #5
0
    def setup_google_auth(self, window, _id, otp_secret):
        vbox = QVBoxLayout()
        window.set_layout(vbox)
        if otp_secret is not None:
            uri = "otpauth://totp/%s?secret=%s" % ('trustedcoin.com',
                                                   otp_secret)
            vbox.addWidget(
                QLabel("Please scan this QR code in Google Authenticator."))
            qrw = QRCodeWidget(uri)
            vbox.addWidget(qrw, 1)
            msg = _('Then, enter your Google Authenticator code:')
        else:
            label = QLabel(
                "This wallet is already registered, but it was never authenticated. To finalize your registration, please enter your Google Authenticator Code. If you do not have this code, delete the wallet file and start a new registration"
            )
            label.setWordWrap(1)
            vbox.addWidget(label)
            msg = _('Google Authenticator code:')

        hbox = QHBoxLayout()
        hbox.addWidget(QLabel(msg))
        pw = AmountEdit(None, is_int=True)
        pw.setFocus(True)
        hbox.addWidget(pw)
        hbox.addStretch(1)
        vbox.addLayout(hbox)

        b = OkButton(window, _('Next'))
        b.setEnabled(False)
        vbox.addLayout(Buttons(CancelButton(window), b))
        pw.textChanged.connect(lambda: b.setEnabled(len(pw.text()) == 6))

        while True:
            if not window.exec_():
                return False
            otp = pw.get_amount()
            try:
                server.auth(_id, otp)
                return True
            except:
                QMessageBox.information(self.window, _('Message'),
                                        _('Incorrect password'), _('OK'))
                pw.setText('')
Exemple #6
0
    def request_otp_dialog(self, window, _id, otp_secret):
        vbox = QVBoxLayout()
        if otp_secret is not None:
            uri = "otpauth://totp/%s?secret=%s"%('trustedcoin.com', otp_secret)
            l = QLabel("Please scan the following QR code in Google Authenticator. You may as well use the following key: %s"%otp_secret)
            l.setWordWrap(True)
            vbox.addWidget(l)
            qrw = QRCodeWidget(uri)
            vbox.addWidget(qrw, 1)
            msg = _('Then, enter your Google Authenticator code:')
        else:
            label = QLabel(
                "This wallet is already registered with Trustedcoin. "
                "To finalize wallet creation, please enter your Google Authenticator Code. "
            )
            label.setWordWrap(1)
            vbox.addWidget(label)
            msg = _('Google Authenticator code:')

        hbox = QHBoxLayout()
        hbox.addWidget(WWLabel(msg))
        pw = AmountEdit(None, is_int = True)
        pw.setFocus(True)
        pw.setMaximumWidth(50)
        hbox.addWidget(pw)
        vbox.addLayout(hbox)

        cb_lost = QCheckBox(_("I have lost my Google Authenticator account"))
        cb_lost.setToolTip(_("Check this box to request a new secret. You will need to retype your seed."))
        vbox.addWidget(cb_lost)
        cb_lost.setVisible(otp_secret is None)

        def set_enabled():
            b = True if cb_lost.isChecked() else len(pw.text()) == 6
            window.next_button.setEnabled(b)

        pw.textChanged.connect(set_enabled)
        cb_lost.toggled.connect(set_enabled)

        window.exec_layout(vbox, next_enabled=False,
                               raise_on_cancel=False)
        return pw.get_amount(), cb_lost.isChecked()
Exemple #7
0
    def setup_google_auth(self, window, _id, otp_secret):
        vbox = QVBoxLayout()
        window.set_layout(vbox)
        if otp_secret is not None:
            uri = "otpauth://totp/%s?secret=%s" % ("trustedcoin.com", otp_secret)
            vbox.addWidget(QLabel("Please scan this QR code in Google Authenticator."))
            qrw = QRCodeWidget(uri)
            vbox.addWidget(qrw, 1)
            msg = _("Then, enter your Google Authenticator code:")
        else:
            label = QLabel(
                "This wallet is already registered, but it was never authenticated. To finalize your registration, please enter your Google Authenticator Code. If you do not have this code, delete the wallet file and start a new registration"
            )
            label.setWordWrap(1)
            vbox.addWidget(label)
            msg = _("Google Authenticator code:")

        hbox = QHBoxLayout()
        hbox.addWidget(QLabel(msg))
        pw = AmountEdit(None, is_int=True)
        pw.setFocus(True)
        hbox.addWidget(pw)
        hbox.addStretch(1)
        vbox.addLayout(hbox)

        b = OkButton(window, _("Next"))
        b.setEnabled(False)
        vbox.addLayout(Buttons(CancelButton(window), b))
        pw.textChanged.connect(lambda: b.setEnabled(len(pw.text()) == 6))

        while True:
            if not window.exec_():
                return False
            otp = pw.get_amount()
            try:
                server.auth(_id, otp)
                return True
            except:
                QMessageBox.information(self.window, _("Message"), _("Incorrect password"), _("OK"))
                pw.setText("")
Exemple #8
0
    def setup_google_auth(self, window, _id, otp_secret):
        vbox = QVBoxLayout()
        if otp_secret is not None:
            uri = "otpauth://totp/%s?secret=%s"%('trustedcoin.com', otp_secret)
            l = QLabel("Please scan the following QR code in Google Authenticator. You may as well use the following key: %s"%otp_secret)
            l.setWordWrap(True)
            vbox.addWidget(l)
            qrw = QRCodeWidget(uri)
            vbox.addWidget(qrw, 1)
            msg = _('Then, enter your Google Authenticator code:')
        else:
            label = QLabel("This wallet is already registered, but it was never authenticated. To finalize your registration, please enter your Google Authenticator Code. If you do not have this code, delete the wallet file and start a new registration")
            label.setWordWrap(1)
            vbox.addWidget(label)
            msg = _('Google Authenticator code:')

        hbox = QHBoxLayout()
        hbox.addWidget(WWLabel(msg))
        pw = AmountEdit(None, is_int = True)
        pw.setFocus(True)
        pw.setMaximumWidth(50)
        hbox.addWidget(pw)
        vbox.addLayout(hbox)

        def set_enabled():
            window.next_button.setEnabled(len(pw.text()) == 6)
        pw.textChanged.connect(set_enabled)

        while True:
            if not window.set_main_layout(vbox, next_enabled=False,
                                          raise_on_cancel=False):
                return False
            otp = pw.get_amount()
            try:
                server.auth(_id, otp)
                return True
            except:
                window.show_message(_('Incorrect password'))
                pw.setText('')