fix(@desktop/profile): settings to store pass in keychain remain the same

Fixes #5464
This commit is contained in:
Sale Djenic 2022-04-11 13:39:15 +02:00 committed by Iuri Matias
parent d9d7a54f84
commit e5fcb4cf9b
5 changed files with 64 additions and 9 deletions

View File

@ -22,6 +22,8 @@ ModalPopup {
property string repeatPasswordValidationError: "" property string repeatPasswordValidationError: ""
property bool storingPasswordModal: false property bool storingPasswordModal: false
signal offerToStorePassword(string password, bool runStoreToKeychainPopup)
id: popup id: popup
title: storingPasswordModal? title: storingPasswordModal?
qsTr("Store password") : qsTr("Store password") :
@ -171,7 +173,7 @@ ModalPopup {
passwordValidationError = qsTr("Incorrect password") passwordValidationError = qsTr("Incorrect password")
} }
else { else {
//Global.applicationWindow.prepareForStoring(repeatPasswordField.text, true) popup.offerToStorePassword(repeatPasswordField.text, true)
popup.close() popup.close()
} }
} }
@ -179,7 +181,7 @@ ModalPopup {
{ {
loading = true loading = true
OnboardingStore.onboardingModuleInst.storeSelectedAccountAndLogin(repeatPasswordField.text); OnboardingStore.onboardingModuleInst.storeSelectedAccountAndLogin(repeatPasswordField.text);
//Global.applicationWindow.prepareForStoring(repeatPasswordField.text, false) popup.offerToStorePassword(repeatPasswordField.text, false)
} }
} }
} }

View File

@ -30,6 +30,14 @@ ModalPopup {
neverBtn.checked = true neverBtn.checked = true
} }
function offerToStorePassword(password, runStoreToKeychainPopup) {
if(Qt.platform.os == "osx")
{
if(runStoreToKeychainPopup)
Global.openPopup(storeToKeychainConfirmationPopupComponent, { password: password })
}
}
Column { Column {
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
@ -103,6 +111,51 @@ ModalPopup {
privacyStore: popup.privacyStore privacyStore: popup.privacyStore
storingPasswordModal: true storingPasswordModal: true
height: 350 height: 350
onOfferToStorePassword: {
popup.offerToStorePassword(password, runStoreToKeychainPopup)
}
}
}
Component {
id: storeToKeychainConfirmationPopupComponent
ConfirmationDialog {
id: storeToKeychainConfirmationPopup
property string password: ""
height: 200
confirmationText: qsTr("Would you like to store password to the Keychain?")
showRejectButton: true
showCancelButton: true
confirmButtonLabel: qsTr("Store")
rejectButtonLabel: qsTr("Not now")
cancelButtonLabel: qsTr("Never")
onClosed: {
destroy()
}
function finish()
{
password = ""
storeToKeychainConfirmationPopup.close()
}
onConfirmButtonClicked: {
localAccountSettings.storeToKeychainValue = Constants.storeToKeychainValueStore
root.privacyStore.storeToKeyChain(password)
finish()
}
onRejectButtonClicked: {
localAccountSettings.storeToKeychainValue = Constants.storeToKeychainValueNotNow
finish()
}
onCancelButtonClicked: {
localAccountSettings.storeToKeychainValue = Constants.storeToKeychainValueNever
finish()
}
} }
} }
} }

View File

@ -28,4 +28,8 @@ QtObject {
function validatePassword(password) { function validatePassword(password) {
return root.privacyModule.validatePassword(password) return root.privacyModule.validatePassword(password)
} }
function storeToKeyChain(pass) {
mainModule.storePassword(pass);
}
} }

View File

@ -69,11 +69,6 @@ Item {
onOpenChooseBrowserPopup: { onOpenChooseBrowserPopup: {
Global.openPopup(chooseBrowserPopupComponent, {link: link}); Global.openPopup(chooseBrowserPopupComponent, {link: link});
} }
onOpenPopupRequested: {
const popup = popupComponent.createObject(appMain, params);
popup.open();
return popup;
}
onOpenDownloadModalRequested: { onOpenDownloadModalRequested: {
const downloadPage = downloadPageComponent.createObject(appMain, const downloadPage = downloadPageComponent.createObject(appMain,
{ {

View File

@ -23,7 +23,6 @@ QtObject {
signal openImagePopup(var image, var contextMenu) signal openImagePopup(var image, var contextMenu)
signal openLinkInBrowser(string link) signal openLinkInBrowser(string link)
signal openChooseBrowserPopup(string link) signal openChooseBrowserPopup(string link)
signal openPopupRequested(var popupComponent, var params)
signal openDownloadModalRequested() signal openDownloadModalRequested()
signal settingsLoaded() signal settingsLoaded()
signal openBackUpSeedPopup() signal openBackUpSeedPopup()
@ -36,7 +35,9 @@ QtObject {
} }
function openPopup(popupComponent, params = {}) { function openPopup(popupComponent, params = {}) {
root.openPopupRequested(popupComponent, params); const popup = popupComponent.createObject(root.appMain, params);
popup.open();
return popup;
} }
function openDownloadModal(){ function openDownloadModal(){