message on incorrect password

This commit is contained in:
Natsumi
2021-06-18 23:11:55 +12:00
parent a6fd63637d
commit de8b839c9f
+14 -10
View File
@@ -5011,7 +5011,7 @@ speechSynthesis.getVoices();
if (this.enablePrimaryPassword) { if (this.enablePrimaryPassword) {
this.enablePrimaryPasswordDialog.visible = true; this.enablePrimaryPasswordDialog.visible = true;
} else { } else {
$app.$prompt( this.$prompt(
'Please enter your Primary Password.', 'Please enter your Primary Password.',
'Primary Password Required', 'Primary Password Required',
{ {
@@ -5031,22 +5031,22 @@ speechSynthesis.getVoices();
}).catch(_ => { }).catch(_ => {
this.enablePrimaryPassword = true; this.enablePrimaryPassword = true;
configRepository.setBool('enablePrimaryPassword', true); configRepository.setBool('enablePrimaryPassword', true);
}) });
} }
} };
$app.methods.setPrimaryPassword = function () { $app.methods.setPrimaryPassword = function () {
configRepository.setBool('enablePrimaryPassword', this.enablePrimaryPassword); configRepository.setBool('enablePrimaryPassword', this.enablePrimaryPassword);
this.enablePrimaryPasswordDialog.visible = false; this.enablePrimaryPasswordDialog.visible = false;
if(this.enablePrimaryPassword) { if (this.enablePrimaryPassword) {
let key = this.enablePrimaryPasswordDialog.password; let key = this.enablePrimaryPasswordDialog.password;
for (let name in this.loginForm.savedCredentials) { for (let name in this.loginForm.savedCredentials) {
security.encrypt(this.loginForm.savedCredentials[name].loginParmas.password, key).then(ct => { security.encrypt(this.loginForm.savedCredentials[name].loginParmas.password, key).then(ct => {
$app.saveCredentials = { username: name, password: ct}; $app.saveCredentials = { username: name, password: ct};
this.updateStoredUser(this.loginForm.savedCredentials[name].user); this.updateStoredUser(this.loginForm.savedCredentials[name].user);
}) });
} }
} }
} };
$app.methods.updateStoredUser = function (currentUser) { $app.methods.updateStoredUser = function (currentUser) {
var savedCredentialsArray = {}; var savedCredentialsArray = {};
@@ -5089,9 +5089,13 @@ speechSynthesis.getVoices();
}); });
}); });
}).catch(_ => { }).catch(_ => {
this.$message({
message: 'Incorrect primary password',
type: 'error'
});
return reject(); return reject();
}) });
}) });
}; };
$app.methods.deleteSavedLogin = function (username) { $app.methods.deleteSavedLogin = function (username) {
@@ -5099,10 +5103,10 @@ speechSynthesis.getVoices();
delete savedCredentialsArray[username]; delete savedCredentialsArray[username];
// Disable primary password when no account is available. // Disable primary password when no account is available.
if (Object.keys(savedCredentialsArray).length === 0) { if (Object.keys(savedCredentialsArray).length === 0) {
$app.enablePrimaryPassword = false; this.enablePrimaryPassword = false;
configRepository.setBool('enablePrimaryPassword', false); configRepository.setBool('enablePrimaryPassword', false);
} }
$app.loginForm.savedCredentials = savedCredentialsArray; this.loginForm.savedCredentials = savedCredentialsArray;
var jsonCredentialsArray = JSON.stringify(savedCredentialsArray); var jsonCredentialsArray = JSON.stringify(savedCredentialsArray);
configRepository.setString('savedCredentials', jsonCredentialsArray); configRepository.setString('savedCredentials', jsonCredentialsArray);
new Noty({ new Noty({