|
@@ -56,7 +56,7 @@ function shakeError(element){
|
|
|
function validateEmail(value){
|
|
function validateEmail(value){
|
|
|
if(value){
|
|
if(value){
|
|
|
if(!basicEmail.test(value) && !validUsername.test(value)){
|
|
if(!basicEmail.test(value) && !validUsername.test(value)){
|
|
|
- showError(loginEmailError, '* Invalid Value')
|
|
|
|
|
|
|
+ showError(loginEmailError, Lang.queryJS('login.error.invalidValue'))
|
|
|
loginDisabled(true)
|
|
loginDisabled(true)
|
|
|
lu = false
|
|
lu = false
|
|
|
} else {
|
|
} else {
|
|
@@ -68,7 +68,7 @@ function validateEmail(value){
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
lu = false
|
|
lu = false
|
|
|
- showError(loginEmailError, '* Required')
|
|
|
|
|
|
|
+ showError(loginEmailError, Lang.queryJS('login.error.requiredValue'))
|
|
|
loginDisabled(true)
|
|
loginDisabled(true)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -87,7 +87,7 @@ function validatePassword(value){
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
lp = false
|
|
lp = false
|
|
|
- showError(loginPasswordError, '* Required')
|
|
|
|
|
|
|
+ showError(loginPasswordError, Lang.queryJS('login.error.invalidValue'))
|
|
|
loginDisabled(true)
|
|
loginDisabled(true)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -129,10 +129,10 @@ function loginDisabled(v){
|
|
|
function loginLoading(v){
|
|
function loginLoading(v){
|
|
|
if(v){
|
|
if(v){
|
|
|
loginButton.setAttribute('loading', v)
|
|
loginButton.setAttribute('loading', v)
|
|
|
- loginButton.innerHTML = loginButton.innerHTML.replace('LOGIN', 'LOGGING IN')
|
|
|
|
|
|
|
+ loginButton.innerHTML = loginButton.innerHTML.replace(Lang.queryJS('login.login'), Lang.queryJS('login.loggingIn'))
|
|
|
} else {
|
|
} else {
|
|
|
loginButton.removeAttribute('loading')
|
|
loginButton.removeAttribute('loading')
|
|
|
- loginButton.innerHTML = loginButton.innerHTML.replace('LOGGING IN', 'LOGIN')
|
|
|
|
|
|
|
+ loginButton.innerHTML = loginButton.innerHTML.replace(Lang.queryJS('login.loggingIn'), Lang.queryJS('login.login'))
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -166,8 +166,8 @@ function resolveError(err){
|
|
|
// Node error => err.code | err.message
|
|
// Node error => err.code | err.message
|
|
|
if(err.cause != null && err.cause === 'UserMigratedException') {
|
|
if(err.cause != null && err.cause === 'UserMigratedException') {
|
|
|
return {
|
|
return {
|
|
|
- title: 'Error During Login:<br>Invalid Credentials',
|
|
|
|
|
- desc: 'You\'ve attempted to login with a migrated account. Try again using the account email as the username.'
|
|
|
|
|
|
|
+ title: Lang.queryJS('login.error.userMigrated.title'),
|
|
|
|
|
+ desc: Lang.queryJS('login.error.userMigrated.desc')
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
if(err.error != null){
|
|
if(err.error != null){
|
|
@@ -175,13 +175,13 @@ function resolveError(err){
|
|
|
if(err.errorMessage != null){
|
|
if(err.errorMessage != null){
|
|
|
if(err.errorMessage === 'Invalid credentials. Invalid username or password.'){
|
|
if(err.errorMessage === 'Invalid credentials. Invalid username or password.'){
|
|
|
return {
|
|
return {
|
|
|
- title: 'Error During Login:<br>Invalid Credentials',
|
|
|
|
|
- desc: 'The email or password you\'ve entered is incorrect. Please try again.'
|
|
|
|
|
|
|
+ title: Lang.queryJS('login.error.invalidCredentials.title'),
|
|
|
|
|
+ desc: Lang.queryJS('login.error.invalidCredentials.desc')
|
|
|
}
|
|
}
|
|
|
} else if(err.errorMessage === 'Invalid credentials.'){
|
|
} else if(err.errorMessage === 'Invalid credentials.'){
|
|
|
return {
|
|
return {
|
|
|
- title: 'Error During Login:<br>Too Many Attempts',
|
|
|
|
|
- desc: 'There have been too many login attempts with this account recently. Please try again later.'
|
|
|
|
|
|
|
+ title: Lang.queryJS('login.error.rateLimit.title'),
|
|
|
|
|
+ desc: Lang.queryJS('login.error.rateLimit.desc')
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -192,14 +192,14 @@ function resolveError(err){
|
|
|
if(err.code === 'ENOENT'){
|
|
if(err.code === 'ENOENT'){
|
|
|
// No Internet.
|
|
// No Internet.
|
|
|
return {
|
|
return {
|
|
|
- title: 'Error During Login:<br>No Internet Connection',
|
|
|
|
|
- desc: 'You must be connected to the internet in order to login. Please connect and try again.'
|
|
|
|
|
|
|
+ title: Lang.queryJS('login.error.noInternet.title'),
|
|
|
|
|
+ desc: Lang.queryJS('login.error.noInternet.desc')
|
|
|
}
|
|
}
|
|
|
} else if(err.code === 'ENOTFOUND'){
|
|
} else if(err.code === 'ENOTFOUND'){
|
|
|
// Could not reach server.
|
|
// Could not reach server.
|
|
|
return {
|
|
return {
|
|
|
- title: 'Error During Login:<br>Authentication Server Offline',
|
|
|
|
|
- desc: 'Mojang\'s authentication server is currently offline or unreachable. Please wait a bit and try again. You can check the status of the server on <a href="https://help.mojang.com/">Mojang\'s help portal</a>.'
|
|
|
|
|
|
|
+ title: Lang.queryJS('login.error.authDown.title'),
|
|
|
|
|
+ desc: Lang.queryJS('login.error.authDown.desc')
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -208,13 +208,13 @@ function resolveError(err){
|
|
|
if(err.message != null){
|
|
if(err.message != null){
|
|
|
if(err.message === 'NotPaidAccount'){
|
|
if(err.message === 'NotPaidAccount'){
|
|
|
return {
|
|
return {
|
|
|
- title: 'Error During Login:<br>Game Not Purchased',
|
|
|
|
|
- desc: 'The account you are trying to login with has not purchased a copy of Minecraft.<br>You may purchase a copy on <a href="https://minecraft.net/">Minecraft.net</a>'
|
|
|
|
|
|
|
+ title: Lang.queryJS('login.error.notPaid.title'),
|
|
|
|
|
+ desc: Lang.queryJS('login.error.notPaid.desc')
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
// Unknown error with request.
|
|
// Unknown error with request.
|
|
|
return {
|
|
return {
|
|
|
- title: 'Error During Login:<br>Unknown Error',
|
|
|
|
|
|
|
+ title: Lang.queryJS('login.error.unknown.title'),
|
|
|
desc: err.message
|
|
desc: err.message
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -264,7 +264,7 @@ loginButton.addEventListener('click', () => {
|
|
|
|
|
|
|
|
AuthManager.addAccount(loginUsername.value, loginPassword.value).then((value) => {
|
|
AuthManager.addAccount(loginUsername.value, loginPassword.value).then((value) => {
|
|
|
updateSelectedAccount(value)
|
|
updateSelectedAccount(value)
|
|
|
- loginButton.innerHTML = loginButton.innerHTML.replace('LOGGING IN', 'SUCCESS')
|
|
|
|
|
|
|
+ loginButton.innerHTML = loginButton.innerHTML.replace(Lang.queryJS('login.loggingIn'), Lang.queryJS('login.success'))
|
|
|
$('.circle-loader').toggleClass('load-complete')
|
|
$('.circle-loader').toggleClass('load-complete')
|
|
|
$('.checkmark').toggle()
|
|
$('.checkmark').toggle()
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
@@ -281,14 +281,14 @@ loginButton.addEventListener('click', () => {
|
|
|
$('.circle-loader').toggleClass('load-complete')
|
|
$('.circle-loader').toggleClass('load-complete')
|
|
|
$('.checkmark').toggle()
|
|
$('.checkmark').toggle()
|
|
|
loginLoading(false)
|
|
loginLoading(false)
|
|
|
- loginButton.innerHTML = loginButton.innerHTML.replace('SUCCESS', 'LOGIN')
|
|
|
|
|
|
|
+ loginButton.innerHTML = loginButton.innerHTML.replace(Lang.queryJS('login.success'), Lang.queryJS('login.login'))
|
|
|
formDisabled(false)
|
|
formDisabled(false)
|
|
|
})
|
|
})
|
|
|
}, 1000)
|
|
}, 1000)
|
|
|
}).catch((err) => {
|
|
}).catch((err) => {
|
|
|
loginLoading(false)
|
|
loginLoading(false)
|
|
|
const errF = resolveError(err)
|
|
const errF = resolveError(err)
|
|
|
- setOverlayContent(errF.title, errF.desc, 'Try Again')
|
|
|
|
|
|
|
+ setOverlayContent(errF.title, errF.desc, Lang.queryJS('login.tryAgain'))
|
|
|
setOverlayHandler(() => {
|
|
setOverlayHandler(() => {
|
|
|
formDisabled(false)
|
|
formDisabled(false)
|
|
|
toggleOverlay(false)
|
|
toggleOverlay(false)
|