Skip to content

Commit

Permalink
Landing page backend localization
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Jan 22, 2022
1 parent e6872fb commit 1ba999d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
18 changes: 10 additions & 8 deletions app/landing/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ logger.getWindow("landing")
*/
localization.localize("landing")

const lang = localization.getLang()

/**
* If running in development
*/
Expand Down Expand Up @@ -92,31 +94,31 @@ const comparePasswords = () => {

if (password_input1.toString().length > 64) {
text.style.color = "#CC001B"
text.textContent = "Maximum password length is 64 characters!"
text.textContent = lang.landing_text.maximum_password
} else if (password_input1.toString().length < 8) {
text.style.color = "#CC001B"
text.textContent = "Minimum password length is 8 characters!"
text.textContent = lang.landing_text.minimum_password
} else {
if (password_input1.toString() == password_input2.toString()) {
if (!password.search(password_input1.toString())) {
logger.log("Passwords match!")

text.style.color = "#28A443"
text.textContent = "Passwords match! Please wait!"
text.textContent = lang.landing_text.passwords_match

password_input1.fill(0)
password_input2.fill(0)

hashPasswords()
} else {
text.style.color = "#CC001B"
text.textContent = "This password is on the list of the top 1000 most common passwords. Please choose a more secure password!"
text.textContent = lang.landing_text.top_1000_password
}
} else {
logger.warn("Passwords dont match!")

text.style.color = "#CC001B"
text.textContent = "Passwords don't match! Try again!"
text.textContent = lang.landing_text.passwords_dont_match
}
}
}
Expand Down Expand Up @@ -180,17 +182,17 @@ const noPassword = () => {
dialog
.showMessageBox({
title: "Authme",
buttons: ["Yes", "No"],
buttons: [lang.button.yes, lang.button.no],
type: "warning",
defaultId: 1,
cancelId: 1,
noLink: true,
message: "Are you sure? \n\nThis way everyone with access to your computer can access your 2FA codes too.",
message: lang.landing_dialog.no_password,
})
.then((result) => {
if (result.response === 0) {
text.style.color = "#28A443"
text.textContent = "Please wait!"
text.textContent = lang.landing_text.please_wait

/**
* Read settings
Expand Down
4 changes: 2 additions & 2 deletions lib/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
* @param {renderer} rendererName
*/
localize: (renderer) => {
const res = electron.ipcRenderer.sendSync("lang").lang_code
const res = electron.ipcRenderer.sendSync("languageCode").language
let loc_id = 0

document.addEventListener("DOMContentLoaded", () => {
Expand All @@ -30,7 +30,7 @@ module.exports = {
* @return {lang}
*/
getLang: () => {
const res = electron.ipcRenderer.sendSync("lang").lang_code
const res = electron.ipcRenderer.sendSync("languageCode").language
return languages[res]
},
}
1 change: 1 addition & 0 deletions lib/typedef.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* @property {boolean} settings.search_filter.name - Filter for names
* @property {boolean} settings.search_filter.description - Filter for description
* @property {number} settings.default_display - Default display
* @property {null|string} settings.language - Change language
*
* @property {object} experimental - Experimental
* @property {null|number} experimental.sort - Sort codes
Expand Down

0 comments on commit 1ba999d

Please sign in to comment.