diff --git a/app/src/main/java/com/keylesspalace/tusky/components/login/LoginActivity.kt b/app/src/main/java/com/keylesspalace/tusky/components/login/LoginActivity.kt
index 4df7abc1..bcbb4abf 100644
--- a/app/src/main/java/com/keylesspalace/tusky/components/login/LoginActivity.kt
+++ b/app/src/main/java/com/keylesspalace/tusky/components/login/LoginActivity.kt
@@ -68,7 +68,9 @@ class LoginActivity : BaseActivity(), Injectable {
// Authorization failed. Put the error response where the user can read it and they
// can try again.
setLoading(false)
- binding.domainTextInputLayout.error = getString(R.string.error_authorization_denied)
+ // Use error returned by the server or fall back to the generic message
+ binding.domainTextInputLayout.error =
+ result.errorMessage.ifBlank { getString(R.string.error_authorization_denied) }
Log.e(
TAG,
"%s %s".format(
diff --git a/app/src/main/java/com/keylesspalace/tusky/components/login/LoginWebViewActivity.kt b/app/src/main/java/com/keylesspalace/tusky/components/login/LoginWebViewActivity.kt
index 58f745e7..a32a164c 100644
--- a/app/src/main/java/com/keylesspalace/tusky/components/login/LoginWebViewActivity.kt
+++ b/app/src/main/java/com/keylesspalace/tusky/components/login/LoginWebViewActivity.kt
@@ -117,7 +117,7 @@ class LoginWebViewActivity : BaseActivity(), Injectable {
error: WebResourceError
) {
Log.d("LoginWeb", "Failed to load ${data.url}: $error")
- finishWithoutSlideOutAnimation()
+ sendResult(LoginResult.Err(getString(R.string.error_could_not_load_login_page)))
}
override fun shouldOverrideUrlLoading(
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 2a209d9a..fc1ed743 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -9,6 +9,7 @@
An unidentified authorization error occurred.
Authorization was denied.
Failed getting a login token.
+ Could not load the login page.
The post is too long!
The file must be less than 8MB.
Video files must be less than 40MB.