diff --git a/app/assets/js/authmanager.js b/app/assets/js/authmanager.js
index 3f431440..5a24f30a 100644
--- a/app/assets/js/authmanager.js
+++ b/app/assets/js/authmanager.js
@@ -12,12 +12,122 @@
const ConfigManager = require('./configmanager')
const { LoggerUtil } = require('helios-core')
const { RestResponseStatus } = require('helios-core/common')
-const { MojangRestAPI, mojangErrorDisplayable, MojangErrorCode } = require('helios-core/mojang')
-const { MicrosoftAuth, microsoftErrorDisplayable, MicrosoftErrorCode } = require('helios-core/microsoft')
+const { MojangRestAPI, MojangErrorCode } = require('helios-core/mojang')
+const { MicrosoftAuth, MicrosoftErrorCode } = require('helios-core/microsoft')
const { AZURE_CLIENT_ID } = require('./ipcconstants')
+const Lang = require('./langloader')
const log = LoggerUtil.getLogger('AuthManager')
+// Error messages
+
+function microsoftErrorDisplayable(errorCode) {
+ switch (errorCode) {
+ case MicrosoftErrorCode.NO_PROFILE:
+ return {
+ title: Lang.queryJS('auth.microsoft.error.noProfileTitle'),
+ desc: Lang.queryJS('auth.microsoft.error.noProfileDesc')
+ }
+ case MicrosoftErrorCode.NO_XBOX_ACCOUNT:
+ return {
+ title: Lang.queryJS('auth.microsoft.error.noXboxAccountTitle'),
+ desc: Lang.queryJS('auth.microsoft.error.noXboxAccountDesc')
+ }
+ case MicrosoftErrorCode.XBL_BANNED:
+ return {
+ title: Lang.queryJS('auth.microsoft.error.xblBannedTitle'),
+ desc: Lang.queryJS('auth.microsoft.error.xblBannedDesc')
+ }
+ case MicrosoftErrorCode.UNDER_18:
+ return {
+ title: Lang.queryJS('auth.microsoft.error.under18Title'),
+ desc: Lang.queryJS('auth.microsoft.error.under18Desc')
+ }
+ case MicrosoftErrorCode.UNKNOWN:
+ return {
+ title: Lang.queryJS('auth.microsoft.error.unknownTitle'),
+ desc: Lang.queryJS('auth.microsoft.error.unknownDesc')
+ }
+ }
+}
+
+function mojangErrorDisplayable(errorCode) {
+ switch(errorCode) {
+ case MojangErrorCode.ERROR_METHOD_NOT_ALLOWED:
+ return {
+ title: Lang.queryJS('auth.mojang.error.methodNotAllowedTitle'),
+ desc: Lang.queryJS('auth.mojang.error.methodNotAllowedDesc')
+ }
+ case MojangErrorCode.ERROR_NOT_FOUND:
+ return {
+ title: Lang.queryJS('auth.mojang.error.notFoundTitle'),
+ desc: Lang.queryJS('auth.mojang.error.notFoundDesc')
+ }
+ case MojangErrorCode.ERROR_USER_MIGRATED:
+ return {
+ title: Lang.queryJS('auth.mojang.error.accountMigratedTitle'),
+ desc: Lang.queryJS('auth.mojang.error.accountMigratedDesc')
+ }
+ case MojangErrorCode.ERROR_INVALID_CREDENTIALS:
+ return {
+ title: Lang.queryJS('auth.mojang.error.invalidCredentialsTitle'),
+ desc: Lang.queryJS('auth.mojang.error.invalidCredentialsDesc')
+ }
+ case MojangErrorCode.ERROR_RATELIMIT:
+ return {
+ title: Lang.queryJS('auth.mojang.error.tooManyAttemptsTitle'),
+ desc: Lang.queryJS('auth.mojang.error.tooManyAttemptsDesc')
+ }
+ case MojangErrorCode.ERROR_INVALID_TOKEN:
+ return {
+ title: Lang.queryJS('auth.mojang.error.invalidTokenTitle'),
+ desc: Lang.queryJS('auth.mojang.error.invalidTokenDesc')
+ }
+ case MojangErrorCode.ERROR_ACCESS_TOKEN_HAS_PROFILE:
+ return {
+ title: Lang.queryJS('auth.mojang.error.tokenHasProfileTitle'),
+ desc: Lang.queryJS('auth.mojang.error.tokenHasProfileDesc')
+ }
+ case MojangErrorCode.ERROR_CREDENTIALS_MISSING:
+ return {
+ title: Lang.queryJS('auth.mojang.error.credentialsMissingTitle'),
+ desc: Lang.queryJS('auth.mojang.error.credentialsMissingDesc')
+ }
+ case MojangErrorCode.ERROR_INVALID_SALT_VERSION:
+ return {
+ title: Lang.queryJS('auth.mojang.error.invalidSaltVersionTitle'),
+ desc: Lang.queryJS('auth.mojang.error.invalidSaltVersionDesc')
+ }
+ case MojangErrorCode.ERROR_UNSUPPORTED_MEDIA_TYPE:
+ return {
+ title: Lang.queryJS('auth.mojang.error.unsupportedMediaTypeTitle'),
+ desc: Lang.queryJS('auth.mojang.error.unsupportedMediaTypeDesc')
+ }
+ case MojangErrorCode.ERROR_GONE:
+ return {
+ title: Lang.queryJS('auth.mojang.error.accountGoneTitle'),
+ desc: Lang.queryJS('auth.mojang.error.accountGoneDesc')
+ }
+ case MojangErrorCode.ERROR_UNREACHABLE:
+ return {
+ title: Lang.queryJS('auth.mojang.error.unreachableTitle'),
+ desc: Lang.queryJS('auth.mojang.error.unreachableDesc')
+ }
+ case MojangErrorCode.ERROR_NOT_PAID:
+ return {
+ title: Lang.queryJS('auth.mojang.error.gameNotPurchasedTitle'),
+ desc: Lang.queryJS('auth.mojang.error.gameNotPurchasedDesc')
+ }
+ case MojangErrorCode.UNKNOWN:
+ return {
+ title: Lang.queryJS('auth.mojang.error.unknownErrorTitle'),
+ desc: Lang.queryJS('auth.mojang.error.unknownErrorDesc')
+ }
+ default:
+ throw new Error(`Unknown error code: ${errorCode}`)
+ }
+}
+
// Functions
/**
diff --git a/app/assets/lang/en_US.toml b/app/assets/lang/en_US.toml
index 59877b74..758e6379 100644
--- a/app/assets/lang/en_US.toml
+++ b/app/assets/lang/en_US.toml
@@ -295,3 +295,45 @@ selectAnotherAccountButton = "Select Another Account"
checkingForUpdateButton = "Checking for Updates..."
installNowButton = "Install Now"
checkForUpdatesButton = "Check for Updates"
+
+[js.auth.microsoft.error]
+noProfileTitle = "Error During Login:
Profile Not Set Up"
+noProfileDesc = "Your Microsoft account does not yet have a Minecraft profile set up. If you have recently purchased the game or redeemed it through Xbox Game Pass, you have to set up your profile on Minecraft.net.
If you have not yet purchased the game, you can also do that on Minecraft.net."
+noXboxAccountTitle = "Error During Login:
No Xbox Account"
+noXboxAccountDesc = "Your Microsoft account has no Xbox account associated with it."
+xblBannedTitle = "Error During Login:
Xbox Live Unavailable"
+xblBannedDesc = "Your Microsoft account is from a country where Xbox Live is not available or banned."
+under18Title = "Error During Login:
Parental Approval Required"
+under18Desc = "Accounts for users under the age of 18 must be added to a Family by an adult."
+unknownTitle = "Unknown Error During Login"
+unknownDesc = "An unknown error has occurred. Please see the console for details."
+
+[js.auth.mojang.error]
+methodNotAllowedTitle = "Internal Error:
Method Not Allowed"
+methodNotAllowedDesc = "Method not allowed. Please report this error."
+notFoundTitle = "Internal Error:
Not Found"
+notFoundDesc = "The authentication endpoint was not found. Please report this issue."
+accountMigratedTitle = "Error During Login:
Account Migrated"
+accountMigratedDesc = "You've attempted to login with a migrated account. Try again using the account email as the username."
+invalidCredentialsTitle = "Error During Login:
Invalid Credentials"
+invalidCredentialsDesc = "The email or password you've entered is incorrect. Please try again."
+tooManyAttemptsTitle = "Error During Login:
Too Many Attempts"
+tooManyAttemptsDesc = "There have been too many login attempts with this account recently. Please try again later."
+invalidTokenTitle = "Error During Login:
Invalid Token"
+invalidTokenDesc = "The provided access token is invalid."
+tokenHasProfileTitle = "Error During Login:
Token Has Profile"
+tokenHasProfileDesc = "Access token already has a profile assigned. Selecting profiles is not implemented yet."
+credentialsMissingTitle = "Error During Login:
Credentials Missing"
+credentialsMissingDesc = "Username/password was not submitted or password is less than 3 characters."
+invalidSaltVersionTitle = "Error During Login:
Invalid Salt Version"
+invalidSaltVersionDesc = "Invalid salt version."
+unsupportedMediaTypeTitle = "Internal Error:
Unsupported Media Type"
+unsupportedMediaTypeDesc = "Unsupported media type. Please report this error."
+accountGoneTitle = "Error During Login:
Account Migrated"
+accountGoneDesc = "Account has been migrated to a Microsoft account. Please log in with Microsoft."
+unreachableTitle = "Error During Login:
Unreachable"
+unreachableDesc = "Unable to reach the authentication servers. Ensure that they are online and you are connected to the internet."
+gameNotPurchasedTitle = "Error During Login:
Game Not Purchased"
+gameNotPurchasedDesc = "The account you are trying to login with has not purchased a copy of Minecraft. You may purchase a copy on Minecraft.net"
+unknownErrorTitle = "Unknown Error During Login"
+unknownErrorDesc = "An unknown error has occurred. Please see the console for details."