]> Untitled Git - lemmy.git/blobdiff - crates/api_common/src/lib.rs
Show deny reason to users after a failed login. Fixes #2191 (#2206)
[lemmy.git] / crates / api_common / src / lib.rs
index c37d40e9aa0d5668846f7af897aabfe6c96f28f1..330c75bd0bbd3ebc549d8def92c5f511dd5c7300 100644 (file)
@@ -485,8 +485,10 @@ pub async fn check_registration_application(
       RegistrationApplication::find_by_local_user_id(conn, local_user_id)
     })
     .await??;
-    if registration.deny_reason.is_some() {
-      return Err(LemmyError::from_message("registration_denied"));
+    if let Some(deny_reason) = registration.deny_reason {
+      let lang = get_user_lang(local_user_view);
+      let registration_denied_message = format!("{}: {}", lang.registration_denied(), &deny_reason);
+      return Err(LemmyError::from_message(&registration_denied_message));
     } else {
       return Err(LemmyError::from_message("registration_application_pending"));
     }