diff --git a/app/assets/js/authmanager.js b/app/assets/js/authmanager.js
index 7d87d1a..22b2fed 100644
--- a/app/assets/js/authmanager.js
+++ b/app/assets/js/authmanager.js
@@ -29,12 +29,17 @@ const loggerSuccess = LoggerUtil('%c[AuthManager]', 'color: #209b07; font-weight
exports.addAccount = async function(username, password){
try {
const session = await Mojang.authenticate(username, password, ConfigManager.getClientToken())
- const ret = ConfigManager.addAuthAccount(session.selectedProfile.id, session.accessToken, username, session.selectedProfile.name)
- if(ConfigManager.getClientToken() == null){
- ConfigManager.setClientToken(session.clientToken)
+ if(session.selectedProfile != null){
+ const ret = ConfigManager.addAuthAccount(session.selectedProfile.id, session.accessToken, username, session.selectedProfile.name)
+ if(ConfigManager.getClientToken() == null){
+ ConfigManager.setClientToken(session.clientToken)
+ }
+ ConfigManager.save()
+ return ret
+ } else {
+ throw new Error('NotPaidAccount')
}
- ConfigManager.save()
- return ret
+
} catch (err){
return Promise.reject(err)
}
diff --git a/app/assets/js/scripts/login.js b/app/assets/js/scripts/login.js
index 56f01df..67e7a58 100644
--- a/app/assets/js/scripts/login.js
+++ b/app/assets/js/scripts/login.js
@@ -206,10 +206,17 @@ function resolveError(err){
}
}
if(err.message != null){
- // Unknown error with request.
- return {
- title: 'Error During Login:
Unknown Error',
- desc: err.message
+ if(err.message === 'NotPaidAccount'){
+ return {
+ title: 'Error During Login:
Game Not Purchased',
+ desc: 'The account you are trying to login with has not purchased a copy of Minecraft.
You may purchase a copy on Minecraft.net'
+ }
+ } else {
+ // Unknown error with request.
+ return {
+ title: 'Error During Login:
Unknown Error',
+ desc: err.message
+ }
}
} else {
// Unknown Mojang error.
@@ -234,11 +241,11 @@ function loginCancelEnabled(val){
loginCancelButton.onclick = (e) => {
switchView(getCurrentView(), loginViewOnCancel, 500, 500, () => {
+ loginUsername.value = ''
+ loginPassword.value = ''
loginCancelEnabled(false)
if(loginViewCancelHandler != null){
loginViewCancelHandler()
- loginUsername.value = ''
- loginPassword.value = ''
loginViewCancelHandler = null
}
})