mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-27 07:34:43 +02:00
🌐 Re: #126 - Implements missing translations for Login action
This commit is contained in:
parent
9f33bacf16
commit
7a669d6ee4
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="display-options">
|
<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" />
|
class="layout-icon" tabindex="-2" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -19,7 +19,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
logout() {
|
logout() {
|
||||||
registerLogout();
|
registerLogout();
|
||||||
this.$toasted.show('Logged Out');
|
this.$toasted.show(this.$t('login.logout-message'));
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
location.reload(true); // eslint-disable-line no-restricted-globals
|
location.reload(true); // eslint-disable-line no-restricted-globals
|
||||||
}, 500);
|
}, 500);
|
||||||
|
@ -43,24 +43,24 @@ export const isLoggedIn = (users) => {
|
|||||||
* @param {String[]} users An array of valid user objects
|
* @param {String[]} users An array of valid user objects
|
||||||
* @returns {Object} An object containing a boolean result and a message
|
* @returns {Object} An object containing a boolean result and a message
|
||||||
*/
|
*/
|
||||||
export const checkCredentials = (username, pass, users) => {
|
export const checkCredentials = (username, pass, users, messages) => {
|
||||||
let response;
|
let response; // Will store an object containing boolean and message
|
||||||
if (!username) {
|
if (!username) {
|
||||||
response = { correct: false, msg: 'Missing Username' };
|
response = { correct: false, msg: messages.missingUsername };
|
||||||
} else if (!pass) {
|
} else if (!pass) {
|
||||||
response = { correct: false, msg: 'Missing Password' };
|
response = { correct: false, msg: messages.missingPassword };
|
||||||
} else {
|
} else {
|
||||||
users.forEach((user) => {
|
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()) {
|
if (user.hash.toLowerCase() === sha256(pass).toString().toLowerCase()) {
|
||||||
response = { correct: true, msg: 'Logging in...' };
|
response = { correct: true, msg: messages.successMsg }; // Password is correct
|
||||||
} else {
|
} else { // User found, but password is not a match
|
||||||
response = { correct: false, msg: 'Incorrect Password' };
|
response = { correct: false, msg: messages.incorrectPassword };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return response || { correct: false, msg: 'User not found' };
|
return response || { correct: false, msg: messages.incorrectUsername };
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user