mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-13 11:56:32 +02:00
Windows: don't allow non-ascii characters in path
This commit is contained in:
parent
1a610db431
commit
abd5c685af
@ -55,7 +55,7 @@ Item {
|
|||||||
settingsObject['words'] = uiItem.wordsTexttext
|
settingsObject['words'] = uiItem.wordsTexttext
|
||||||
settingsObject['wallet_path'] = uiItem.walletPath
|
settingsObject['wallet_path'] = uiItem.walletPath
|
||||||
var walletFullPath = wizard.createWalletPath(uiItem.walletPath,uiItem.accountNameText);
|
var walletFullPath = wizard.createWalletPath(uiItem.walletPath,uiItem.accountNameText);
|
||||||
return !wizard.walletExists(walletFullPath);
|
return wizard.walletPathValid(walletFullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkNextButton() {
|
function checkNextButton() {
|
||||||
|
@ -141,13 +141,31 @@ Rectangle {
|
|||||||
return folder_path + "/" + account_name + "/" + account_name
|
return folder_path + "/" + account_name + "/" + account_name
|
||||||
}
|
}
|
||||||
|
|
||||||
function walletExists(path){
|
function walletPathValid(path){
|
||||||
if (walletManager.walletExists(path)) {
|
if (walletManager.walletExists(path)) {
|
||||||
walletExistsErrorDialog.open();
|
walletErrorDialog.text = qsTr("A wallet with same name already exists. Please change wallet name") + translationManager.emptyString;
|
||||||
|
walletErrorDialog.open();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't allow non ascii characters in path on windows platforms until supported by Wallet2
|
||||||
|
if (isWindows) {
|
||||||
|
if (!isAscii(path)) {
|
||||||
|
walletErrorDialog.text = qsTr("Non-ASCII characters are not allowed in wallet path or account name") + translationManager.emptyString;
|
||||||
|
walletErrorDialog.open();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isAscii(str){
|
||||||
|
for (var i = 0; i < str.length; i++) {
|
||||||
|
if (str.charCodeAt(i) > 127)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//! actually writes the wallet
|
//! actually writes the wallet
|
||||||
function applySettings() {
|
function applySettings() {
|
||||||
@ -197,9 +215,8 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MessageDialog {
|
MessageDialog {
|
||||||
id: walletExistsErrorDialog
|
id: walletErrorDialog
|
||||||
title: "Error"
|
title: "Error"
|
||||||
text: qsTr("A wallet with same name already exists. Please change wallet name") + translationManager.emptyString
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ Item {
|
|||||||
var restoreHeight = parseInt(uiItem.restoreHeight);
|
var restoreHeight = parseInt(uiItem.restoreHeight);
|
||||||
settingsObject['restore_height'] = isNaN(restoreHeight)? 0 : restoreHeight
|
settingsObject['restore_height'] = isNaN(restoreHeight)? 0 : restoreHeight
|
||||||
var walletFullPath = wizard.createWalletPath(uiItem.walletPath,uiItem.accountNameText);
|
var walletFullPath = wizard.createWalletPath(uiItem.walletPath,uiItem.accountNameText);
|
||||||
if(wizard.walletExists(walletFullPath)){
|
if(!wizard.walletPathValid(walletFullPath)){
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return recoveryWallet(settingsObject)
|
return recoveryWallet(settingsObject)
|
||||||
|
Loading…
Reference in New Issue
Block a user