Almost there

This commit is contained in:
Zach Fox 2017-08-18 16:28:02 -07:00
parent c42a658bde
commit 94da149ac8
3 changed files with 41 additions and 24 deletions

View file

@ -30,6 +30,10 @@ Item {
onSecurityImageResult: { onSecurityImageResult: {
passphrasePageSecurityImage.source = gridModel.getImagePathFromImageID(imageID); passphrasePageSecurityImage.source = gridModel.getImagePathFromImageID(imageID);
} }
onPassphraseSetupStatusResult: {
sendMessageToLightbox({method: 'statusResult', status: passphraseIsSetup});
}
} }
onVisibleChanged: { onVisibleChanged: {
@ -52,6 +56,12 @@ Item {
height: 50; height: 50;
echoMode: TextInput.Password; echoMode: TextInput.Password;
placeholderText: "passphrase"; placeholderText: "passphrase";
onVisibleChanged: {
if (visible) {
text = "";
}
}
} }
HifiControlsUit.TextField { HifiControlsUit.TextField {
id: passphraseFieldAgain; id: passphraseFieldAgain;
@ -62,6 +72,12 @@ Item {
height: 50; height: 50;
echoMode: TextInput.Password; echoMode: TextInput.Password;
placeholderText: "re-enter passphrase"; placeholderText: "re-enter passphrase";
onVisibleChanged: {
if (visible) {
text = "";
}
}
} }
// Security Image // Security Image
@ -202,8 +218,5 @@ Item {
errorText.text = text; errorText.text = text;
} }
function clearText() { signal sendMessageToLightbox(var msg);
passphraseField.text = "";
passphraseFieldAgain.text = "";
}
} }

View file

@ -27,19 +27,19 @@ Rectangle {
// Style // Style
color: hifi.colors.baseGray; color: hifi.colors.baseGray;
Hifi.QmlCommerce { Connections {
id: commerce; target: passphraseSelection;
onSendMessageToLightbox: {
onPassphraseSetupStatusResult: { if (msg.method === 'statusResult') {
console.log("ZRF HERE " + passphraseIsSetup); if (msg.status) {
if (passphraseIsSetup) { // Success submitting new passphrase
// Success submitting new passphrase root.resetSubmitButton();
passphraseSubmitButton.enabled = true; root.visible = false;
root.visible = false; } else {
} else { // Error submitting new passphrase
// Error submitting new passphrase root.resetSubmitButton();
passphraseSubmitButton.enabled = true; passphraseSelection.setErrorText("Backend error");
passphraseSelection.setErrorText("Backend error"); }
} }
} }
} }
@ -132,7 +132,6 @@ Rectangle {
width: 100; width: 100;
text: "Cancel" text: "Cancel"
onClicked: { onClicked: {
passphraseSelection.clearText();
root.visible = false; root.visible = false;
} }
} }
@ -151,10 +150,7 @@ Rectangle {
width: 100; width: 100;
text: "Submit"; text: "Submit";
onClicked: { onClicked: {
if (passphraseSelection.validateAndSubmitPassphrase()) { passphraseSelection.validateAndSubmitPassphrase()
passphraseSubmitButton.text = "Submitting...";
passphraseSubmitButton.enabled = false;
}
} }
} }
} }
@ -162,4 +158,9 @@ Rectangle {
// //
// SECURE PASSPHRASE SELECTION END // SECURE PASSPHRASE SELECTION END
// //
function resetSubmitButton() {
passphraseSubmitButton.enabled = true;
passphraseSubmitButton.text = "Submit";
}
} }

View file

@ -35,11 +35,13 @@ Rectangle {
if (imageID !== 0) { // Success submitting new security image if (imageID !== 0) { // Success submitting new security image
if (root.justSubmitted) { if (root.justSubmitted) {
securityImageSubmitButton.enabled = true; securityImageSubmitButton.enabled = true;
securityImageSubmitButton.text = "Submit";
root.visible = false; root.visible = false;
} }
} else if (root.lastPage === "securityImage") { } else if (root.justSubmitted) {
// Error submitting new security image. // Error submitting new security image.
securityImageSubmitButton.enabled = true; securityImageSubmitButton.enabled = true
securityImageSubmitButton.text = "Submit";
root.justSubmitted = false; root.justSubmitted = false;
} }
} }
@ -176,6 +178,7 @@ Rectangle {
root.justSubmitted = true; root.justSubmitted = true;
securityImageSubmitButton.text = "Submitting..."; securityImageSubmitButton.text = "Submitting...";
securityImageSubmitButton.enabled = false; securityImageSubmitButton.enabled = false;
commerce.chooseSecurityImage(securityImageSelection.getSelectedImageIndex());
} }
} }
} }