Added localised error messages.

pull/77/head
Mikunj 7 years ago
parent 9e995bde6c
commit 7d0d244e7c

@ -1708,6 +1708,9 @@
"typeInOldPassword": { "typeInOldPassword": {
"message": "Please type in your old password" "message": "Please type in your old password"
}, },
"invalidOldPassword": {
"message": "Old password is invalid"
},
"invalidPassword": { "invalidPassword": {
"message": "Invalid password" "message": "Invalid password"
}, },

@ -959,7 +959,8 @@ ipc.on('password-window-login', async (event, passPhrase) => {
passwordWindow = null; passwordWindow = null;
} }
} catch (e) { } catch (e) {
sendResponse('Invalid password'); const localisedError = locale.messages.invalidPassword.message;
sendResponse(localisedError || 'Invalid password');
} }
}); });
@ -971,7 +972,8 @@ ipc.on('set-password', async (event, passPhrase, oldPhrase) => {
const hash = await sql.getPasswordHash(); const hash = await sql.getPasswordHash();
const hashMatches = oldPhrase && passwordUtil.matchesHash(oldPhrase, hash); const hashMatches = oldPhrase && passwordUtil.matchesHash(oldPhrase, hash);
if (hash && !hashMatches) { if (hash && !hashMatches) {
sendResponse('Failed to set password: Old password provided is invalid'); const incorrectOldPassword = locale.messages.invalidOldPassword.message;
sendResponse(incorrectOldPassword || 'Failed to set password: Old password provided is invalid');
return; return;
} }
@ -987,7 +989,8 @@ ipc.on('set-password', async (event, passPhrase, oldPhrase) => {
sendResponse(); sendResponse();
} catch (e) { } catch (e) {
sendResponse('Failed to set password'); const localisedError = locale.messages.setPasswordFail.message;
sendResponse(localisedError || 'Failed to set password');
} }
}); });

Loading…
Cancel
Save