]> Untitled Git - lemmy.git/commitdiff
Check for slurs in account creation. (#2443)
authorDessalines <dessalines@users.noreply.github.com>
Mon, 19 Sep 2022 19:42:42 +0000 (15:42 -0400)
committerGitHub <noreply@github.com>
Mon, 19 Sep 2022 19:42:42 +0000 (19:42 +0000)
crates/api_crud/src/user/create.rs

index 7d35f3207e0d36d53eed69590807afc911d06611..2d2fe66afcfe8af9ab4d2267468fc14936159eee 100644 (file)
@@ -26,7 +26,7 @@ use lemmy_db_views_actor::structs::PersonViewSafe;
 use lemmy_utils::{
   claims::Claims,
   error::LemmyError,
-  utils::{check_slurs, is_valid_actor_name},
+  utils::{check_slurs, check_slurs_opt, is_valid_actor_name},
   ConnectionId,
 };
 use lemmy_websocket::{messages::CheckCaptcha, LemmyContext};
@@ -99,7 +99,9 @@ impl PerformCrud for Register {
       }
     }
 
-    check_slurs(&data.username, &context.settings().slur_regex())?;
+    let slur_regex = &context.settings().slur_regex();
+    check_slurs(&data.username, slur_regex)?;
+    check_slurs_opt(&data.answer, slur_regex)?;
 
     let actor_keypair = generate_actor_keypair()?;
     if !is_valid_actor_name(&data.username, context.settings().actor_name_max_length) {