1 use crate::PerformCrud;
2 use actix_web::web::Data;
4 use lemmy_api_common::{
6 person::{DeleteAccount, DeleteAccountResponse},
7 utils::get_local_user_view_from_jwt,
9 use lemmy_utils::{error::LemmyError, ConnectionId};
11 #[async_trait::async_trait(?Send)]
12 impl PerformCrud for DeleteAccount {
13 type Response = DeleteAccountResponse;
15 #[tracing::instrument(skip(self, context, _websocket_id))]
18 context: &Data<LemmyContext>,
19 _websocket_id: Option<ConnectionId>,
20 ) -> Result<Self::Response, LemmyError> {
23 get_local_user_view_from_jwt(data.auth.as_ref(), context.pool(), context.secret()).await?;
25 // Verify the password
26 let valid: bool = verify(
28 &local_user_view.local_user.password_encrypted,
32 return Err(LemmyError::from_message("password_incorrect"));
35 Ok(DeleteAccountResponse {})