mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-20 02:00:55 +07:00
fix: correctly save password on set or change
This commit is contained in:
@@ -223,6 +223,26 @@ QString SettingsUiController::getHint()
|
||||
return m_settingsController->getHint();
|
||||
}
|
||||
|
||||
void SettingsUiController::setTempPassword(QString pwd)
|
||||
{
|
||||
tempPassword = pwd;
|
||||
}
|
||||
|
||||
QString SettingsUiController::getTempPassword()
|
||||
{
|
||||
return tempPassword;
|
||||
}
|
||||
|
||||
void SettingsUiController::setTempHint(QString hint)
|
||||
{
|
||||
tempHint = hint;
|
||||
}
|
||||
|
||||
QString SettingsUiController::getTempHint()
|
||||
{
|
||||
return tempHint;
|
||||
}
|
||||
|
||||
bool SettingsUiController::isAutoConnectEnabled()
|
||||
{
|
||||
return m_settingsController->isAutoConnectEnabled();
|
||||
|
||||
@@ -81,6 +81,11 @@ public slots:
|
||||
bool isNewsNotificationsEnabled();
|
||||
void toggleNewsNotificationsEnabled(bool enable);
|
||||
|
||||
void setTempPassword(QString pwd);
|
||||
QString getTempPassword();
|
||||
void setTempHint(QString hint);
|
||||
QString getTempHint();
|
||||
|
||||
bool isScreenshotsEnabled();
|
||||
void toggleScreenshotsEnabled(bool enable);
|
||||
|
||||
@@ -151,6 +156,9 @@ signals:
|
||||
void changingPassword();
|
||||
|
||||
private:
|
||||
QString tempPassword;
|
||||
QString tempHint;
|
||||
|
||||
SettingsController* m_settingsController;
|
||||
ServersController* m_serversController;
|
||||
LanguageUiController* m_languageUiController;
|
||||
|
||||
@@ -125,8 +125,8 @@ PageType {
|
||||
var _password = listView.itemAtIndex(vars.passwordIndex).children[0].textField.text
|
||||
var _hint = listView.itemAtIndex(vars.hintIndex).children[0].textField.text
|
||||
|
||||
SettingsController.setPassword(_password)
|
||||
SettingsController.setHint(_hint)
|
||||
SettingsController.setTempPassword(_password)
|
||||
SettingsController.setTempHint(_hint)
|
||||
|
||||
PageController.goToPage(PageEnum.PageSettingsAppPasswordConfirm)
|
||||
if (root.isChangingPassword) {
|
||||
|
||||
@@ -108,7 +108,7 @@ PageType {
|
||||
Layout.rightMargin: 16
|
||||
Layout.bottomMargin: 24
|
||||
|
||||
text: SettingsController.getHint()
|
||||
text: SettingsController.getTempHint()
|
||||
}
|
||||
|
||||
BasicButtonType {
|
||||
@@ -125,6 +125,12 @@ PageType {
|
||||
return
|
||||
}
|
||||
|
||||
SettingsController.setPassword(SettingsController.getTempPassword())
|
||||
SettingsController.setHint(SettingsController.getTempHint())
|
||||
|
||||
SettingsController.setTempPassword("")
|
||||
SettingsController.setTempHint("")
|
||||
|
||||
PageController.closePage()
|
||||
PageController.goToPage(PageEnum.PageSettings)
|
||||
PageController.goToPage(PageEnum.PageSettingsAppEncryption)
|
||||
@@ -138,7 +144,7 @@ PageType {
|
||||
var notMatch = false
|
||||
|
||||
var secretDataItem = listView.itemAtIndex(0).children[0]
|
||||
if (secretDataItem.textField.text !== SettingsController.getPassword()) {
|
||||
if (secretDataItem.textField.text !== SettingsController.getTempPassword()) {
|
||||
secretDataItem.errorText = qsTr("Passwords not match")
|
||||
notMatch = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user