mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-23 05:49:22 +00:00
Ready to start to delete user account
This commit is contained in:
parent
8253779725
commit
f031f7b4b3
@ -9,7 +9,7 @@ use crate::api_data::res_check_security_questions_exists::ResCheckSecurityQuesti
|
|||||||
use crate::api_data::res_get_security_questions::ResGetSecurityQuestions;
|
use crate::api_data::res_get_security_questions::ResGetSecurityQuestions;
|
||||||
use crate::constants::PASSWORD_RESET_TOKEN_LENGTH;
|
use crate::constants::PASSWORD_RESET_TOKEN_LENGTH;
|
||||||
use crate::controllers::routes::RequestResult;
|
use crate::controllers::routes::RequestResult;
|
||||||
use crate::data::error::{ExecError, ResultBoxError};
|
use crate::data::error::ResultBoxError;
|
||||||
use crate::data::http_request_handler::HttpRequestHandler;
|
use crate::data::http_request_handler::HttpRequestHandler;
|
||||||
use crate::data::new_account::NewAccount;
|
use crate::data::new_account::NewAccount;
|
||||||
use crate::data::user::{User, UserID};
|
use crate::data::user::{User, UserID};
|
||||||
@ -194,6 +194,12 @@ pub fn export_data(r: &mut HttpRequestHandler) -> RequestResult {
|
|||||||
pub fn delete_account(r: &mut HttpRequestHandler) -> RequestResult {
|
pub fn delete_account(r: &mut HttpRequestHandler) -> RequestResult {
|
||||||
r.need_user_password("password")?;
|
r.need_user_password("password")?;
|
||||||
|
|
||||||
// TODO : implement me
|
if r.user_id()?.id() < 2 {
|
||||||
r.internal_error(ExecError::boxed_new("Not implemented yet"))
|
// I do not want anybody delete my account...
|
||||||
|
r.forbidden("You shall not delete MY account (whoever you are, please note that hacking is bad !!!)".to_string())?;
|
||||||
|
}
|
||||||
|
|
||||||
|
account_helper::delete(r.user_id_ref()?);
|
||||||
|
|
||||||
|
r.success("Account deleted.")
|
||||||
}
|
}
|
@ -298,3 +298,14 @@ pub fn export(user_id: &UserID) -> ResultBoxError<AccountExport> {
|
|||||||
|
|
||||||
Ok(data)
|
Ok(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Delete a user's account
|
||||||
|
pub fn delete(user_id: &UserID) -> ResultBoxError {
|
||||||
|
// TODO : close all websockets of user
|
||||||
|
|
||||||
|
// TODO : Delete all group membership
|
||||||
|
|
||||||
|
// TODO : continue work here
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user