Microsoft Authentication (#216)
This commit is contained in:
@@ -21,7 +21,7 @@ const loginForm = document.getElementById('loginForm')
|
||||
// Control variables.
|
||||
let lu = false, lp = false
|
||||
|
||||
const loggerLogin = LoggerUtil('%c[Login]', 'color: #000668; font-weight: bold')
|
||||
const loggerLogin = LoggerUtil1('%c[Login]', 'color: #000668; font-weight: bold')
|
||||
|
||||
|
||||
/**
|
||||
@@ -189,7 +189,7 @@ loginButton.addEventListener('click', () => {
|
||||
// Show loading stuff.
|
||||
loginLoading(true)
|
||||
|
||||
AuthManager.addAccount(loginUsername.value, loginPassword.value).then((value) => {
|
||||
AuthManager.addMojangAccount(loginUsername.value, loginPassword.value).then((value) => {
|
||||
updateSelectedAccount(value)
|
||||
loginButton.innerHTML = loginButton.innerHTML.replace(Lang.queryJS('login.loggingIn'), Lang.queryJS('login.success'))
|
||||
$('.circle-loader').toggleClass('load-complete')
|
||||
@@ -214,13 +214,26 @@ loginButton.addEventListener('click', () => {
|
||||
}, 1000)
|
||||
}).catch((displayableError) => {
|
||||
loginLoading(false)
|
||||
setOverlayContent(displayableError.title, displayableError.desc, Lang.queryJS('login.tryAgain'))
|
||||
|
||||
let actualDisplayableError
|
||||
if(isDisplayableError(displayableError)) {
|
||||
msftLoginLogger.error('Error while logging in.', displayableError)
|
||||
actualDisplayableError = displayableError
|
||||
} else {
|
||||
// Uh oh.
|
||||
msftLoginLogger.error('Unhandled error during login.', displayableError)
|
||||
actualDisplayableError = {
|
||||
title: 'Unknown Error During Login',
|
||||
desc: 'An unknown error has occurred. Please see the console for details.'
|
||||
}
|
||||
}
|
||||
|
||||
setOverlayContent(actualDisplayableError.title, actualDisplayableError.desc, Lang.queryJS('login.tryAgain'))
|
||||
setOverlayHandler(() => {
|
||||
formDisabled(false)
|
||||
toggleOverlay(false)
|
||||
})
|
||||
toggleOverlay(true)
|
||||
loggerLogin.log('Error while logging in.', displayableError)
|
||||
})
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user