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

View file

@ -27,19 +27,19 @@ Rectangle {
// Style
color: hifi.colors.baseGray;
Hifi.QmlCommerce {
id: commerce;
onPassphraseSetupStatusResult: {
console.log("ZRF HERE " + passphraseIsSetup);
if (passphraseIsSetup) {
// Success submitting new passphrase
passphraseSubmitButton.enabled = true;
root.visible = false;
} else {
// Error submitting new passphrase
passphraseSubmitButton.enabled = true;
passphraseSelection.setErrorText("Backend error");
Connections {
target: passphraseSelection;
onSendMessageToLightbox: {
if (msg.method === 'statusResult') {
if (msg.status) {
// Success submitting new passphrase
root.resetSubmitButton();
root.visible = false;
} else {
// Error submitting new passphrase
root.resetSubmitButton();
passphraseSelection.setErrorText("Backend error");
}
}
}
}
@ -132,7 +132,6 @@ Rectangle {
width: 100;
text: "Cancel"
onClicked: {
passphraseSelection.clearText();
root.visible = false;
}
}
@ -151,10 +150,7 @@ Rectangle {
width: 100;
text: "Submit";
onClicked: {
if (passphraseSelection.validateAndSubmitPassphrase()) {
passphraseSubmitButton.text = "Submitting...";
passphraseSubmitButton.enabled = false;
}
passphraseSelection.validateAndSubmitPassphrase()
}
}
}
@ -162,4 +158,9 @@ Rectangle {
//
// 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 (root.justSubmitted) {
securityImageSubmitButton.enabled = true;
securityImageSubmitButton.text = "Submit";
root.visible = false;
}
} else if (root.lastPage === "securityImage") {
} else if (root.justSubmitted) {
// Error submitting new security image.
securityImageSubmitButton.enabled = true;
securityImageSubmitButton.enabled = true
securityImageSubmitButton.text = "Submit";
root.justSubmitted = false;
}
}
@ -176,6 +178,7 @@ Rectangle {
root.justSubmitted = true;
securityImageSubmitButton.text = "Submitting...";
securityImageSubmitButton.enabled = false;
commerce.chooseSecurityImage(securityImageSelection.getSelectedImageIndex());
}
}
}