Ok(())
}
}
+
+/// Checks for a honeypot. If this field is filled, fail the rest of the function
+pub fn honeypot_check(honeypot: &Option<String>) -> Result<(), LemmyError> {
+ if honeypot.is_some() {
+ Err(ApiError::err("honeypot_fail").into())
+ } else {
+ Ok(())
+ }
+}
pub email: Option<String>,
pub captcha_uuid: Option<String>,
pub captcha_answer: Option<String>,
+ pub honeypot: Option<String>,
}
#[derive(Deserialize)]
pub community_id: CommunityId,
pub url: Option<Url>,
pub body: Option<String>,
+ pub honeypot: Option<String>,
pub nsfw: Option<bool>,
pub auth: String,
}
blocking,
check_community_ban,
get_local_user_view_from_jwt,
+ honeypot_check,
mark_post_as_read,
post::*,
};
let slur_regex = &context.settings().slur_regex();
check_slurs(&data.name, slur_regex)?;
check_slurs_opt(&data.body, slur_regex)?;
+ honeypot_check(&data.honeypot)?;
if !is_valid_post_title(&data.name) {
return Err(ApiError::err("invalid_post_title").into());
show_nsfw: true,
captcha_uuid: None,
captcha_answer: None,
+ honeypot: None,
};
let login_response = register.perform(context, websocket_id).await?;
info!("Admin {} created", setup.admin_username);
use crate::PerformCrud;
use actix_web::web::Data;
-use lemmy_api_common::{blocking, password_length_check, person::*};
+use lemmy_api_common::{blocking, honeypot_check, password_length_check, person::*};
use lemmy_apub::{
generate_apub_endpoint,
generate_followers_url,
}
password_length_check(&data.password)?;
+ honeypot_check(&data.honeypot)?;
// Make sure passwords match
if data.password != data.password_verify {