mirror of
https://github.com/monero-project/monero-gui
synced 2024-12-19 04:45:53 +01:00
ask user for the password if wallet is password-protected
This commit is contained in:
parent
fc7a7ddf25
commit
6f1343aaa0
5
components/PasswordDialog.qml
Normal file
5
components/PasswordDialog.qml
Normal file
@ -0,0 +1,5 @@
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
|
||||
}
|
40
main.qml
40
main.qml
@ -139,19 +139,18 @@ ApplicationWindow {
|
||||
if (typeof wizard.settings['wallet'] !== 'undefined') {
|
||||
wallet = wizard.settings['wallet'];
|
||||
} else {
|
||||
var wallet_path = persistentSettings.wallet_path + "/" + persistentSettings.account_name + "/"
|
||||
+ persistentSettings.account_name;
|
||||
var wallet_path = walletPath();
|
||||
|
||||
console.log("opening wallet at: ", wallet_path);
|
||||
// TODO: wallet password dialog
|
||||
wallet = walletManager.openWallet(wallet_path, "", persistentSettings.testnet);
|
||||
|
||||
|
||||
if (wallet.status !== Wallet.Status_Ok) {
|
||||
console.log("Error opening wallet: ", wallet.errorString);
|
||||
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
||||
informationPopup.text = qsTr("Couldn't open wallet: ") + wallet.errorString;
|
||||
informationPopup.icon = StandardIcon.Critical
|
||||
informationPopup.open()
|
||||
console.error("Error opening wallet with empty password: ", wallet.errorString);
|
||||
|
||||
// try to open wallet with password;
|
||||
passwordDialog.open();
|
||||
return;
|
||||
}
|
||||
console.log("Wallet opened successfully: ", wallet.errorString);
|
||||
@ -165,6 +164,13 @@ ApplicationWindow {
|
||||
|
||||
}
|
||||
|
||||
function walletPath() {
|
||||
var wallet_path = persistentSettings.wallet_path + "/" + persistentSettings.account_name + "/"
|
||||
+ persistentSettings.account_name;
|
||||
return wallet_path;
|
||||
}
|
||||
|
||||
|
||||
function onWalletUpdate() {
|
||||
console.log(">>> wallet updated")
|
||||
basicPanel.unlockedBalanceText = leftPanel.unlockedBalanceText = walletManager.displayAmount(wallet.unlockedBalance);
|
||||
@ -291,6 +297,7 @@ ApplicationWindow {
|
||||
// Information dialog
|
||||
MessageDialog {
|
||||
id: informationPopup
|
||||
|
||||
standardButtons: StandardButton.Ok
|
||||
}
|
||||
|
||||
@ -303,6 +310,25 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
PasswordDialog {
|
||||
id: passwordDialog
|
||||
standardButtons: StandardButton.Ok + StandardButton.Cancel
|
||||
onAccepted: {
|
||||
|
||||
var wallet_path = walletPath();
|
||||
console.log("opening wallet with password: ", wallet_path);
|
||||
wallet = walletManager.openWallet(wallet_path, password, persistentSettings.testnet);
|
||||
if (wallet.status !== Wallet.Status_Ok) {
|
||||
console.error("Error opening wallet with password: ", wallet.errorString);
|
||||
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
||||
informationPopup.text = qsTr("Couldn't open wallet: ") + wallet.errorString;
|
||||
informationPopup.icon = StandardIcon.Critical
|
||||
informationPopup.open()
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Window {
|
||||
id: walletInitializationSplash
|
||||
modality: Qt.ApplicationModal
|
||||
|
@ -155,6 +155,8 @@ langrel.CONFIG += no_link
|
||||
|
||||
QMAKE_EXTRA_TARGETS += langupd deploy deploy_win
|
||||
QMAKE_EXTRA_COMPILERS += langrel
|
||||
|
||||
|
||||
PRE_TARGETDEPS += langupd compiler_langrel_make_all
|
||||
|
||||
RESOURCES += qml.qrc
|
||||
@ -180,7 +182,8 @@ OTHER_FILES += \
|
||||
$$TRANSLATIONS
|
||||
|
||||
DISTFILES += \
|
||||
notes.txt
|
||||
notes.txt \
|
||||
components/PasswordDialog.qml
|
||||
|
||||
# windows application icon
|
||||
RC_FILE = monero-core.rc
|
||||
|
1
qml.qrc
1
qml.qrc
@ -114,5 +114,6 @@
|
||||
<file>pages/Receive.qml</file>
|
||||
<file>components/IconButton.qml</file>
|
||||
<file>lang/flags/italy.png</file>
|
||||
<file>components/PasswordDialog.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -78,24 +78,6 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: remove it
|
||||
function handlePageChanged() {
|
||||
|
||||
// switch (pages[currentPage]) {
|
||||
//// case finishPage:
|
||||
//// // display settings summary
|
||||
//// finishPage.updateSettingsSummary();
|
||||
//// nextButton.visible = false;
|
||||
//// break;
|
||||
// case recoveryWalletPage:
|
||||
// // disable "next button" until 25 words private key entered
|
||||
// nextButton.enabled = false
|
||||
// break
|
||||
// default:
|
||||
// nextButton.enabled = true
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
function openCreateWalletPage() {
|
||||
@ -126,10 +108,9 @@ Rectangle {
|
||||
|
||||
//! actually writes the wallet
|
||||
function applySettings() {
|
||||
print ("Here we apply the settings");
|
||||
console.log("Here we apply the settings");
|
||||
// here we need to actually move wallet to the new location
|
||||
// put wallet files to the subdirectory with the same name as
|
||||
// wallet name
|
||||
|
||||
var new_wallet_filename = settings.wallet_path + "/"
|
||||
+ settings.account_name + "/"
|
||||
+ settings.account_name;
|
||||
@ -138,9 +119,12 @@ Rectangle {
|
||||
if (new_wallet_filename !== settings.wallet_filename) {
|
||||
// using previously saved wallet;
|
||||
settings.wallet.store(new_wallet_filename);
|
||||
//walletManager.moveWallet(settingsObject.wallet_filename, new_wallet_filename);
|
||||
}
|
||||
|
||||
// protecting wallet with password
|
||||
console.log("Protecting wallet with password: " + settings.wallet_password)
|
||||
settings.wallet.setPassword(settings.wallet_password);
|
||||
|
||||
// saving wallet_filename;
|
||||
settings['wallet_filename'] = new_wallet_filename;
|
||||
|
||||
@ -163,17 +147,6 @@ Rectangle {
|
||||
}
|
||||
|
||||
|
||||
// Settings {
|
||||
// id: persistentSettings
|
||||
|
||||
// property string language
|
||||
// property string account_name
|
||||
// property string wallet_path
|
||||
// property bool auto_donations_enabled : true
|
||||
// property int auto_donations_amount : 50
|
||||
// property bool allow_background_mining : true
|
||||
// }
|
||||
|
||||
Rectangle {
|
||||
id: nextButton
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
Loading…
Reference in New Issue
Block a user