Move Microsoft/Mojang error message to lang file.
This commit is contained in:
parent
95eebc18a7
commit
fcd888b68d
@ -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
|
||||
|
||||
/**
|
||||
|
@ -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:<br>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 <a href=\"https://minecraft.net/\">Minecraft.net</a>.<br><br>If you have not yet purchased the game, you can also do that on <a href=\"https://minecraft.net/\">Minecraft.net</a>."
|
||||
noXboxAccountTitle = "Error During Login:<br>No Xbox Account"
|
||||
noXboxAccountDesc = "Your Microsoft account has no Xbox account associated with it."
|
||||
xblBannedTitle = "Error During Login:<br>Xbox Live Unavailable"
|
||||
xblBannedDesc = "Your Microsoft account is from a country where Xbox Live is not available or banned."
|
||||
under18Title = "Error During Login:<br>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:<br>Method Not Allowed"
|
||||
methodNotAllowedDesc = "Method not allowed. Please report this error."
|
||||
notFoundTitle = "Internal Error:<br>Not Found"
|
||||
notFoundDesc = "The authentication endpoint was not found. Please report this issue."
|
||||
accountMigratedTitle = "Error During Login:<br>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:<br>Invalid Credentials"
|
||||
invalidCredentialsDesc = "The email or password you've entered is incorrect. Please try again."
|
||||
tooManyAttemptsTitle = "Error During Login:<br>Too Many Attempts"
|
||||
tooManyAttemptsDesc = "There have been too many login attempts with this account recently. Please try again later."
|
||||
invalidTokenTitle = "Error During Login:<br>Invalid Token"
|
||||
invalidTokenDesc = "The provided access token is invalid."
|
||||
tokenHasProfileTitle = "Error During Login:<br>Token Has Profile"
|
||||
tokenHasProfileDesc = "Access token already has a profile assigned. Selecting profiles is not implemented yet."
|
||||
credentialsMissingTitle = "Error During Login:<br>Credentials Missing"
|
||||
credentialsMissingDesc = "Username/password was not submitted or password is less than 3 characters."
|
||||
invalidSaltVersionTitle = "Error During Login:<br>Invalid Salt Version"
|
||||
invalidSaltVersionDesc = "Invalid salt version."
|
||||
unsupportedMediaTypeTitle = "Internal Error:<br>Unsupported Media Type"
|
||||
unsupportedMediaTypeDesc = "Unsupported media type. Please report this error."
|
||||
accountGoneTitle = "Error During Login:<br>Account Migrated"
|
||||
accountGoneDesc = "Account has been migrated to a Microsoft account. Please log in with Microsoft."
|
||||
unreachableTitle = "Error During Login:<br>Unreachable"
|
||||
unreachableDesc = "Unable to reach the authentication servers. Ensure that they are online and you are connected to the internet."
|
||||
gameNotPurchasedTitle = "Error During Login:<br>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 <a href=\"https://minecraft.net/\">Minecraft.net</a>"
|
||||
unknownErrorTitle = "Unknown Error During Login"
|
||||
unknownErrorDesc = "An unknown error has occurred. Please see the console for details."
|
||||
|
Loading…
Reference in New Issue
Block a user