2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
2020-07-27 15:11:24 +00:00
|
|
|
import "../imports"
|
2020-05-19 13:22:38 +00:00
|
|
|
|
2020-06-12 20:47:44 +00:00
|
|
|
Item {
|
|
|
|
property var onClosed: function () {}
|
|
|
|
id: existingKeyView
|
2020-06-02 08:41:24 +00:00
|
|
|
anchors.fill: parent
|
2020-05-19 13:22:38 +00:00
|
|
|
|
2020-06-12 20:47:44 +00:00
|
|
|
Component.onCompleted: {
|
|
|
|
enterSeedPhraseModal.open()
|
2020-06-02 08:41:24 +00:00
|
|
|
}
|
2020-05-19 13:22:38 +00:00
|
|
|
|
2020-06-12 20:47:44 +00:00
|
|
|
EnterSeedPhraseModal {
|
|
|
|
property bool wentNext: false
|
|
|
|
id: enterSeedPhraseModal
|
|
|
|
onConfirmSeedClick: function (mnemonic) {
|
2020-09-30 12:33:26 +00:00
|
|
|
error = "";
|
2020-07-27 15:11:24 +00:00
|
|
|
|
2021-04-12 15:40:49 +00:00
|
|
|
if (!Utils.isMnemonic(mnemonic)) {
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Invalid seed phrase"
|
|
|
|
error = qsTrId("custom-seed-phrase")
|
2020-07-27 15:11:24 +00:00
|
|
|
} else {
|
|
|
|
error = onboardingModel.validateMnemonic(mnemonic)
|
2021-04-12 15:40:49 +00:00
|
|
|
const regex = new RegExp('word [a-z]+ not found in the dictionary', 'i');
|
|
|
|
if (regex.test(error)) {
|
|
|
|
error = qsTr('Invalid seed phrase') + '. ' +
|
|
|
|
qsTr("This seed phrase doesn't match our supported dictionary. Check for misspelled words.")
|
|
|
|
}
|
2020-07-27 15:11:24 +00:00
|
|
|
}
|
|
|
|
|
2021-03-17 17:00:11 +00:00
|
|
|
if (error === "") {
|
2020-06-25 09:06:31 +00:00
|
|
|
wentNext = true
|
|
|
|
enterSeedPhraseModal.close()
|
|
|
|
onboardingModel.importMnemonic(mnemonic)
|
2021-02-18 19:14:31 +00:00
|
|
|
removeMnemonicAfterLogin = true
|
2020-10-08 11:26:16 +00:00
|
|
|
recoverySuccessModal.open()
|
2020-06-25 09:06:31 +00:00
|
|
|
}
|
2020-06-02 08:41:24 +00:00
|
|
|
}
|
2020-06-12 20:47:44 +00:00
|
|
|
onClosed: function () {
|
|
|
|
if (!wentNext) {
|
|
|
|
existingKeyView.onClosed()
|
2020-06-02 08:41:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-08 11:26:16 +00:00
|
|
|
MnemonicRecoverySuccessModal {
|
|
|
|
id: recoverySuccessModal
|
|
|
|
onButtonClicked: {
|
|
|
|
recoverySuccessModal.close()
|
|
|
|
createPasswordModal.open()
|
|
|
|
}
|
|
|
|
onClosed: function () {
|
|
|
|
if (!enterSeedPhraseModal.wentNext) {
|
|
|
|
existingKeyView.onClosed()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-12 20:47:44 +00:00
|
|
|
CreatePasswordModal {
|
|
|
|
id: createPasswordModal
|
|
|
|
onClosed: function () {
|
|
|
|
existingKeyView.onClosed()
|
2020-06-02 08:41:24 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-19 13:22:38 +00:00
|
|
|
}
|
2020-06-02 08:41:24 +00:00
|
|
|
|
2020-05-19 13:22:38 +00:00
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;autoSize:true;height:480;width:640}
|
|
|
|
}
|
|
|
|
##^##*/
|