+ return Err(LemmyErrorType::PasswordsDoNotMatch)?;
+ }
+
+ if local_site.site_setup && local_site.captcha_enabled {
+ if let Some(captcha_uuid) = &data.captcha_uuid {
+ let uuid = uuid::Uuid::parse_str(captcha_uuid)?;
+ let check = CaptchaAnswer::check_captcha(
+ &mut context.pool(),
+ CheckCaptchaAnswer {
+ uuid,
+ answer: data.captcha_answer.clone().unwrap_or_default(),
+ },
+ )
+ .await?;
+ if !check {
+ return Err(LemmyErrorType::CaptchaIncorrect)?;
+ }
+ } else {
+ return Err(LemmyErrorType::CaptchaIncorrect)?;
+ }