Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

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

Alicia Sykes7a669d6ee424
diff --git a/src/components/Settings/AppButtons.vue b/src/components/Settings/AppButtons.vue
index 8425fefc..875ae11b 100644
--- a/src/components/Settings/AppButtons.vue
+++ b/src/components/Settings/AppButtons.vue
@@ -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);
diff --git a/src/utils/Auth.js b/src/utils/Auth.js
index a64a7ba4..9ccca77c 100644
--- a/src/utils/Auth.js
+++ b/src/utils/Auth.js
@@ -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 };
};
/**