mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-11-16 04:45:34 +00:00
full login translations
This commit is contained in:
parent
987a73ea05
commit
1d202b7a18
@ -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!"
|
||||
}
|
||||
|
@ -44,18 +44,18 @@
|
||||
<div id="loginPopupContentBody" class="authBody">
|
||||
<div id="loginPopupContentBodyText">
|
||||
<span id="loggingInTo">
|
||||
Logging in to <span id="loginPopupServer"></span>
|
||||
<span id="loggingInToIndicator">Logging in to </span><span id="loginPopupServer"></span>
|
||||
</span>
|
||||
</div>
|
||||
<div id="loginPopupContentBodyInputs" class="authInputs">
|
||||
<div id="loginPopupContentBodyInputsUsername">
|
||||
<span>
|
||||
<span id="loginUsernameIndicator">
|
||||
Username:
|
||||
</span>
|
||||
<input type="text" id="loginUsername" />
|
||||
</div>
|
||||
<div id="loginPopupContentBodyInputsPassword">
|
||||
<span>
|
||||
<span id="loginPasswordIndicator">
|
||||
Password:
|
||||
</span>
|
||||
<input type="password" id="loginPassword" onsubmit="login()" />
|
||||
@ -82,24 +82,24 @@
|
||||
<div id="registerPopupContentBody" style="display: none" class="authBody">
|
||||
<div id="registerPopupContentBodyText">
|
||||
<span id="registeringTo">
|
||||
Registering for <span id="registerPopupServer"></span>
|
||||
<span id="registeringToIndicator">Registering for </span><span id="registerPopupServer"></span>
|
||||
</span>
|
||||
</div>
|
||||
<div id="registerPopupContentBodyInputs" class="authInputs">
|
||||
<div id="registerPopupContentBodyInputsUsername">
|
||||
<span>
|
||||
<span id="registerUsernameIndicator">
|
||||
Username:
|
||||
</span>
|
||||
<input type="text" id="registerUsername" />
|
||||
</div>
|
||||
<div id="registerPopupContentBodyInputsPassword">
|
||||
<span>
|
||||
<span id="registerPasswordIndicator">
|
||||
Password:
|
||||
</span>
|
||||
<input type="password" id="registerPassword" />
|
||||
</div>
|
||||
<div id="registerPopupContentBodyInputsPasswordConfirm">
|
||||
<span>
|
||||
<span id="registerConfirmIndicator">
|
||||
Confirm Password:
|
||||
</span>
|
||||
<input type="password" id="registerPasswordConfirm" />
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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')
|
||||
}
|
Loading…
Reference in New Issue
Block a user