diff --git a/languages/en.json b/languages/en.json
index b1249c3..c0d8cf7 100644
--- a/languages/en.json
+++ b/languages/en.json
@@ -39,5 +39,27 @@
"proxyInstallDeny": "No thanks",
"gameFolderDialog": "Select game folder",
- "grasscutterFileDialog": "Select Grasscutter server jar file"
+ "grasscutterFileDialog": "Select Grasscutter server jar file",
+
+ "loggingInTo": "Logging in to: ",
+ "registeringFor": "Registering for: ",
+ "authUsername": "Username: ",
+ "authPassword": "Password: ",
+ "authConfirmPassword": "Confirm Password: ",
+ "authLoginBtn": "Login",
+ "authRegisterBtn": "Register",
+ "authLoginTitle": "Login",
+ "authRegisterTitle": "Register",
+ "launchWithoutAuth": "Launch without Authentication",
+
+ "alertInvalid": "Invalid username or password",
+ "alertNoPass": "No password set, please change password",
+ "alertUnknown": "Unknown error, contact server owner",
+ "alertAuthNoLogin": "Authentication is disabled, no need to log in!",
+ "alertLoginSuccess": "Login successful! Token copied to clipboard. Paste this token into the username field of the game to log in.",
+
+ "alertUserTaken": "Username is taken",
+ "alertPassMismatch": "Password and password confirmation do not match",
+ "alertAuthNoRegister": "Authentication is disabled, no need to register!",
+ "alertRegisterSuccess": "Registration successful!"
}
diff --git a/resources/index.html b/resources/index.html
index 297f5e8..c971d61 100644
--- a/resources/index.html
+++ b/resources/index.html
@@ -44,18 +44,18 @@
- Logging in to
+ Logging in to
-
+
Username:
-
+
Password:
@@ -82,24 +82,24 @@
- Registering for
+ Registering for
-
+
Username:
-
+
Password:
-
+
Confirm Password:
diff --git a/resources/js/index.js b/resources/js/index.js
index 743eb58..abe3973 100644
--- a/resources/js/index.js
+++ b/resources/js/index.js
@@ -298,10 +298,10 @@ async function openLogin() {
// Check if we even need to authenticate
const { data } = await axios.get(url + '/grasscutter/auth_status')
- if (data?.message !== 'AUTH_ENABLED') {
- launchPrivate()
- return
- }
+ // if (data?.message !== 'AUTH_ENABLED') {
+ // launchPrivate()
+ // return
+ // }
loginIpDisplay.innerText = ip
registerIpDisplay.innerText = ip
diff --git a/resources/js/login.js b/resources/js/login.js
index 085c3af..5fd7f8e 100644
--- a/resources/js/login.js
+++ b/resources/js/login.js
@@ -66,22 +66,25 @@ async function login() {
switch(data.message) {
case 'INVALID_ACCOUNT':
- displayLoginAlert('Invalid username or password', 'error');
+ displayLoginAlert(localeObj.alertInvalid || 'Invalid username or password', 'error');
break;
case 'NO_PASSWORD':
// No account password, create one with change password
- displayLoginAlert('No password set, please change password', 'warn');
+ displayLoginAlert(localeObj.alertNoPass || 'No password set, please change password', 'warn');
break;
case 'UNKNOWN':
// Unknown error, contact server owner
- displayLoginAlert('Unknown error, contact server owner', 'error');
+ displayLoginAlert(localeObj.alertUnknown || 'Unknown error, contact server owner', 'error');
break;
+ case undefined:
+ case null:
case 'AUTH_DISABLED':
// Authentication is disabled, we can just connect the user
- displayLoginAlert('Authentication is disabled, no need to log in!', 'warn');
+ displayLoginAlert(localeObj.alertAuthNoLogin || 'Authentication is disabled, no need to log in!', 'warn');
+ launchPrivate();
break;
default:
@@ -89,7 +92,7 @@ async function login() {
const tkData = parseJwt(data.jwt)
await Neutralino.clipboard.writeText(tkData.token)
- displayLoginAlert('Login successful! Token copied to clipboard. Paste this token into the username field of the game to log in.', 'success', 8000);
+ displayLoginAlert(localeObj.alertLoginSuccess || 'Login successful! Token copied to clipboard. Paste this token into the username field of the game to log in.', 'success', 8000);
launchPrivate()
break;
}
@@ -119,22 +122,24 @@ async function register() {
switch(data.message) {
case 'USERNAME_TAKEN':
// Username is taken
- displayRegisterAlert('Username is taken', 'error');
+ displayRegisterAlert(localeObj.alertUserTaken || 'Username is taken', 'error');
break;
case 'PASSWORD_MISMATCH':
// The password and password confirmation do not match
- displayRegisterAlert('Password and password confirmation do not match', 'error');
+ displayRegisterAlert(localStorage.alertPassMismatch || 'Password and password confirmation do not match', 'error');
break;
case 'UNKNOWN':
// Unknown error, contact server owner
- displayRegisterAlert('Unknown error, contact server owner', 'error');
+ displayRegisterAlert(localeObj.alertUnknown || 'Unknown error, contact server owner', 'error');
break;
+ case undefined:
+ case null:
case 'AUTH_DISABLED':
// Authentication is disabled, we can just connect the user
- displayRegisterAlert('Authentication is disabled, no need to register!', 'warn');
+ displayRegisterAlert(localeObj.alertAuthNoRegister || 'Authentication is disabled, no need to register!', 'warn');
break;
default:
@@ -143,7 +148,7 @@ async function register() {
loginUsername.value = username;
setLoginSection();
- displayLoginAlert('Registration successful!', 'success', 5000);
+ displayLoginAlert(localeObj.alertRegisterSuccess || 'Registration successful!', 'success', 5000);
break;
}
}
diff --git a/resources/js/translation.js b/resources/js/translation.js
index 40f058b..3fab70b 100644
--- a/resources/js/translation.js
+++ b/resources/js/translation.js
@@ -17,7 +17,7 @@ async function doTranslation() {
engLocaleObj = JSON.parse(engLocale)
localeObj = JSON.parse(localization)
- const set = (id, localeString) => document.getElementById(id).innerHTML = localeObj[localeString] || engLocaleObj[localeString]
+ const set = (id, localeString) => document.getElementById(id).innerText = localeObj[localeString] || engLocaleObj[localeString]
// Begin filling in values
set('titleSection', 'appName')
@@ -75,4 +75,18 @@ async function doTranslation() {
set('firstTimeInstallBtn', 'proxyInstallBtn')
set('firstTimeDenyBtn', 'proxyInstallDeny')
+
+ // Login section
+ set('loginSectionTitle', 'authLoginTitle')
+ set('registerSectionTitle', 'authRegisterTitle')
+ set('loggingInToIndicator', 'loggingInTo')
+ set('registeringToIndicator', 'registeringFor')
+ set('loginUsernameIndicator', 'authUsername')
+ set('loginPasswordIndicator', 'authPassword')
+ set('registerUsernameIndicator', 'authUsername')
+ set('registerPasswordIndicator', 'authPassword')
+ set('registerConfirmIndicator', 'authConfirmPassword')
+ set('loginPopupContentBodyBtnLogin', 'authLoginBtn')
+ set('loginPopupContentBodyBtnRegister', 'authRegisterBtn')
+ set('noLoginBtn', 'launchWithoutAuth')
}
\ No newline at end of file