🌐 Re: #126 - Implements missing translations for Login action

This commit is contained in:
Alicia Sykes 2021-08-07 14:19:28 +01:00
parent 9f33bacf16
commit 7a669d6ee4
2 changed files with 11 additions and 11 deletions

View File

@ -1,7 +1,7 @@
<template>
<div>
<div class="display-options">
<IconLogout @click="logout()" v-tooltip="tooltip('Sign Out')"
<IconLogout @click="logout()" v-tooltip="tooltip($t('settings.sign-out-tooltip'))"
class="layout-icon" tabindex="-2" />
</div>
</div>
@ -19,7 +19,7 @@ export default {
methods: {
logout() {
registerLogout();
this.$toasted.show('Logged Out');
this.$toasted.show(this.$t('login.logout-message'));
setTimeout(() => {
location.reload(true); // eslint-disable-line no-restricted-globals
}, 500);

View File

@ -43,24 +43,24 @@ export const isLoggedIn = (users) => {
* @param {String[]} users An array of valid user objects
* @returns {Object} An object containing a boolean result and a message
*/
export const checkCredentials = (username, pass, users) => {
let response;
export const checkCredentials = (username, pass, users, messages) => {
let response; // Will store an object containing boolean and message
if (!username) {
response = { correct: false, msg: 'Missing Username' };
response = { correct: false, msg: messages.missingUsername };
} else if (!pass) {
response = { correct: false, msg: 'Missing Password' };
response = { correct: false, msg: messages.missingPassword };
} else {
users.forEach((user) => {
if (user.user.toLowerCase() === username.toLowerCase()) {
if (user.user.toLowerCase() === username.toLowerCase()) { // User found
if (user.hash.toLowerCase() === sha256(pass).toString().toLowerCase()) {
response = { correct: true, msg: 'Logging in...' };
} else {
response = { correct: false, msg: 'Incorrect Password' };
response = { correct: true, msg: messages.successMsg }; // Password is correct
} else { // User found, but password is not a match
response = { correct: false, msg: messages.incorrectPassword };
}
}
});
}
return response || { correct: false, msg: 'User not found' };
return response || { correct: false, msg: messages.incorrectUsername };
};
/**