Prevent access to bot routes as bot.

This commit is contained in:
Paul
2021-09-03 14:37:40 +01:00
parent 17a378494c
commit dbfed52f17
9 changed files with 30 additions and 2 deletions

View File

@@ -26,6 +26,10 @@ pub struct Data {
#[patch("/<target>", data = "<data>")]
pub async fn edit_bot(user: User, target: Ref, data: Json<Data>) -> Result<EmptyResponse> {
if user.bot.is_some() {
return Err(Error::IsBot)
}
let data = data.into_inner();
data.validate()
.map_err(|error| Error::FailedValidation { error })?;