mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Change passphrase working
This commit is contained in:
parent
11d0062104
commit
e64b0861a1
4 changed files with 20 additions and 12 deletions
|
@ -90,7 +90,7 @@ Item {
|
||||||
} else {
|
} else {
|
||||||
// Error submitting new passphrase
|
// Error submitting new passphrase
|
||||||
resetSubmitButton();
|
resetSubmitButton();
|
||||||
passphraseSelection.setErrorText("Backend error");
|
passphraseSelection.setErrorText("Current passphrase incorrect - try again");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sendSignalToWallet(msg);
|
sendSignalToWallet(msg);
|
||||||
|
@ -137,9 +137,10 @@ Item {
|
||||||
width: 150;
|
width: 150;
|
||||||
text: "Submit";
|
text: "Submit";
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (passphraseSelection.validateAndSubmitPassphrase()) {
|
passphraseSubmitButton.text = "Submitting...";
|
||||||
passphraseSubmitButton.text = "Submitting...";
|
passphraseSubmitButton.enabled = false;
|
||||||
passphraseSubmitButton.enabled = false;
|
if (!passphraseSelection.validateAndSubmitPassphrase()) {
|
||||||
|
resetSubmitButton();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,8 @@ Item {
|
||||||
passphrasePageSecurityImage.source = "image://security/securityImage";
|
passphrasePageSecurityImage.source = "image://security/securityImage";
|
||||||
}
|
}
|
||||||
|
|
||||||
onWalletAuthenticatedStatusResult: {
|
onChangePassphraseStatusResult: {
|
||||||
sendMessageToLightbox({method: 'statusResult', status: isAuthenticated});
|
sendMessageToLightbox({method: 'statusResult', status: changeSuccess});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ Item {
|
||||||
passphraseFieldAgain.error = false;
|
passphraseFieldAgain.error = false;
|
||||||
currentPassphraseField.error = false;
|
currentPassphraseField.error = false;
|
||||||
setErrorText("");
|
setErrorText("");
|
||||||
commerce.setPassphrase(passphraseField.text);
|
commerce.changePassphrase(currentPassphraseField.text, passphraseField.text);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,13 +117,18 @@ void QmlCommerce::history() {
|
||||||
ledger->history(wallet->listPublicKeys());
|
ledger->history(wallet->listPublicKeys());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlCommerce::changePassphrase(const QString& oldPassphrase, const QString& newPassphrase) {
|
||||||
|
auto wallet = DependencyManager::get<Wallet>();
|
||||||
|
if ((wallet->getPassphrase()->isEmpty() || wallet->getPassphrase() == oldPassphrase) && !newPassphrase.isEmpty()) {
|
||||||
|
emit changePassphraseStatusResult(wallet->changePassphrase(newPassphrase));
|
||||||
|
} else {
|
||||||
|
emit changePassphraseStatusResult(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QmlCommerce::setPassphrase(const QString& passphrase) {
|
void QmlCommerce::setPassphrase(const QString& passphrase) {
|
||||||
auto wallet = DependencyManager::get<Wallet>();
|
auto wallet = DependencyManager::get<Wallet>();
|
||||||
if(wallet->getPassphrase() && !wallet->getPassphrase()->isEmpty() && !passphrase.isEmpty()) {
|
wallet->setPassphrase(passphrase);
|
||||||
wallet->changePassphrase(passphrase);
|
|
||||||
} else {
|
|
||||||
wallet->setPassphrase(passphrase);
|
|
||||||
}
|
|
||||||
getWalletAuthenticatedStatus();
|
getWalletAuthenticatedStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ signals:
|
||||||
void keyFilePathIfExistsResult(const QString& path);
|
void keyFilePathIfExistsResult(const QString& path);
|
||||||
void securityImageResult(bool exists);
|
void securityImageResult(bool exists);
|
||||||
void walletAuthenticatedStatusResult(bool isAuthenticated);
|
void walletAuthenticatedStatusResult(bool isAuthenticated);
|
||||||
|
void changePassphraseStatusResult(bool changeSuccess);
|
||||||
|
|
||||||
void buyResult(QJsonObject result);
|
void buyResult(QJsonObject result);
|
||||||
// Balance and Inventory are NOT properties, because QML can't change them (without risk of failure), and
|
// Balance and Inventory are NOT properties, because QML can't change them (without risk of failure), and
|
||||||
|
@ -60,6 +61,7 @@ protected:
|
||||||
|
|
||||||
Q_INVOKABLE void chooseSecurityImage(const QString& imageFile);
|
Q_INVOKABLE void chooseSecurityImage(const QString& imageFile);
|
||||||
Q_INVOKABLE void setPassphrase(const QString& passphrase);
|
Q_INVOKABLE void setPassphrase(const QString& passphrase);
|
||||||
|
Q_INVOKABLE void changePassphrase(const QString& oldPassphrase, const QString& newPassphrase);
|
||||||
|
|
||||||
Q_INVOKABLE void buy(const QString& assetId, int cost, const bool controlledFailure = false);
|
Q_INVOKABLE void buy(const QString& assetId, int cost, const bool controlledFailure = false);
|
||||||
Q_INVOKABLE void balance();
|
Q_INVOKABLE void balance();
|
||||||
|
|
Loading…
Reference in a new issue