mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:18:38 +02:00
Passphrases working
This commit is contained in:
parent
d052b49a54
commit
05648bdbcb
1 changed files with 136 additions and 1 deletions
|
@ -354,6 +354,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
id: passphraseTitle;
|
||||||
// Size
|
// Size
|
||||||
width: parent.width;
|
width: parent.width;
|
||||||
height: 50;
|
height: 50;
|
||||||
|
@ -380,6 +381,130 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Text below title bar
|
||||||
|
RalewaySemiBold {
|
||||||
|
id: passphraseTitleHelper;
|
||||||
|
text: "Choose a Secure Passphrase";
|
||||||
|
// Text size
|
||||||
|
size: 24;
|
||||||
|
// Anchors
|
||||||
|
anchors.top: passphraseTitle.bottom;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 16;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 16;
|
||||||
|
height: 50;
|
||||||
|
// Style
|
||||||
|
color: hifi.colors.darkGray;
|
||||||
|
// Alignment
|
||||||
|
horizontalAlignment: Text.AlignHLeft;
|
||||||
|
verticalAlignment: Text.AlignVCenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiControlsUit.TextField {
|
||||||
|
id: passphraseField;
|
||||||
|
anchors.top: passphraseTitleHelper.bottom;
|
||||||
|
anchors.topMargin: 30;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 16;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 16;
|
||||||
|
height: 50;
|
||||||
|
echoMode: TextInput.Password;
|
||||||
|
placeholderText: "passphrase";
|
||||||
|
}
|
||||||
|
HifiControlsUit.TextField {
|
||||||
|
id: passphraseFieldAgain;
|
||||||
|
anchors.top: passphraseField.bottom;
|
||||||
|
anchors.topMargin: 10;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 16;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 16;
|
||||||
|
height: 50;
|
||||||
|
echoMode: TextInput.Password;
|
||||||
|
placeholderText: "re-enter passphrase";
|
||||||
|
}
|
||||||
|
// Error text below TextFields
|
||||||
|
RalewaySemiBold {
|
||||||
|
id: errorText;
|
||||||
|
text: "";
|
||||||
|
// Text size
|
||||||
|
size: 16;
|
||||||
|
// Anchors
|
||||||
|
anchors.top: passphraseFieldAgain.bottom;
|
||||||
|
anchors.topMargin: 0;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 16;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 16;
|
||||||
|
height: 30;
|
||||||
|
// Style
|
||||||
|
color: hifi.colors.redHighlight;
|
||||||
|
// Alignment
|
||||||
|
horizontalAlignment: Text.AlignHLeft;
|
||||||
|
verticalAlignment: Text.AlignVCenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Text below TextFields
|
||||||
|
RalewaySemiBold {
|
||||||
|
id: passwordReqs;
|
||||||
|
text: "Passphrase must be at least 4 characters";
|
||||||
|
// Text size
|
||||||
|
size: 16;
|
||||||
|
// Anchors
|
||||||
|
anchors.top: passphraseFieldAgain.bottom;
|
||||||
|
anchors.topMargin: 16;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 16;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 16;
|
||||||
|
height: 30;
|
||||||
|
// Style
|
||||||
|
color: hifi.colors.darkGray;
|
||||||
|
// Alignment
|
||||||
|
horizontalAlignment: Text.AlignHLeft;
|
||||||
|
verticalAlignment: Text.AlignVCenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show passphrase text
|
||||||
|
HifiControlsUit.CheckBox {
|
||||||
|
id: showPassphrase;
|
||||||
|
colorScheme: hifi.colorSchemes.dark;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 16;
|
||||||
|
anchors.top: passwordReqs.bottom;
|
||||||
|
anchors.topMargin: 16;
|
||||||
|
height: 30;
|
||||||
|
text: "Show passphrase as plain text";
|
||||||
|
boxSize: 24;
|
||||||
|
onClicked: {
|
||||||
|
passphraseField.echoMode = checked ? TextInput.Normal : TextInput.Password;
|
||||||
|
passphraseFieldAgain.echoMode = checked ? TextInput.Normal : TextInput.Password;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Text below checkbox
|
||||||
|
RalewaySemiBold {
|
||||||
|
text: "Your passphrase is used to encrypt your private keys. <b>Please write it down.</b> If it is lost, you will not be able to recover it.";
|
||||||
|
// Text size
|
||||||
|
size: 16;
|
||||||
|
// Anchors
|
||||||
|
anchors.top: showPassphrase.bottom;
|
||||||
|
anchors.topMargin: 16;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 16;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 16;
|
||||||
|
height: paintedHeight;
|
||||||
|
// Style
|
||||||
|
color: hifi.colors.darkGray;
|
||||||
|
wrapMode: Text.WordWrap;
|
||||||
|
// Alignment
|
||||||
|
horizontalAlignment: Text.AlignHLeft;
|
||||||
|
verticalAlignment: Text.AlignVCenter;
|
||||||
|
}
|
||||||
|
|
||||||
// Navigation Bar
|
// Navigation Bar
|
||||||
Item {
|
Item {
|
||||||
// Size
|
// Size
|
||||||
|
@ -437,7 +562,17 @@ Rectangle {
|
||||||
width: 100;
|
width: 100;
|
||||||
text: "Next";
|
text: "Next";
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (passphraseField.text.length < 4) {
|
||||||
|
errorText.text = "Passphrase too short."
|
||||||
|
} else if (passphraseField.text !== passphraseFieldAgain.text) {
|
||||||
|
errorText.text = "Passphrases don't match."
|
||||||
|
} else {
|
||||||
|
errorText.text = ""
|
||||||
|
root.lastPage = "passphrase";
|
||||||
|
commerce.setPassphrase(passphraseField.text);
|
||||||
|
choosePassphraseContainer.visible = false;
|
||||||
|
privateKeysReadyContainer.visible = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue