mirror of
https://github.com/Lissy93/dashy.git
synced 2025-04-08 17:06:18 +02:00
🌐 Re: #126 - Implements missing translations for Login action
This commit is contained in:
parent
9f33bacf16
commit
7a669d6ee4
@ -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);
|
||||
|
@ -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 };
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user