From fb7f56c35946237684a2b26f3580ebc40cf9fe55 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Tue, 14 Jul 2020 10:13:19 +0200 Subject: [PATCH] Add placeholder for account deletion --- src/controllers/account_controller.rs | 10 +++++++++- src/controllers/routes.rs | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/controllers/account_controller.rs b/src/controllers/account_controller.rs index 0ee462e..2279d5f 100644 --- a/src/controllers/account_controller.rs +++ b/src/controllers/account_controller.rs @@ -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::constants::PASSWORD_RESET_TOKEN_LENGTH; use crate::controllers::routes::RequestResult; -use crate::data::error::ResultBoxError; +use crate::data::error::{ExecError, ResultBoxError}; use crate::data::http_request_handler::HttpRequestHandler; use crate::data::new_account::NewAccount; use crate::data::user::{User, UserID}; @@ -188,4 +188,12 @@ pub fn export_data(r: &mut HttpRequestHandler) -> RequestResult { let data = account_helper::export(r.user_id_ref()?)?; r.set_response(AccountExportAPI::new(&data)?) +} + +/// Delete an account +pub fn delete_account(r: &mut HttpRequestHandler) -> RequestResult { + r.need_user_password("password")?; + + // TODO : implement me + r.internal_error(ExecError::boxed_new("Not implemented yet")) } \ No newline at end of file diff --git a/src/controllers/routes.rs b/src/controllers/routes.rs index c19d6d5..8b9fba9 100644 --- a/src/controllers/routes.rs +++ b/src/controllers/routes.rs @@ -82,6 +82,7 @@ pub fn get_routes() -> Vec { Route::post_without_login("/account/check_password_reset_token", Box::new(account_controller::check_password_reset_token)), Route::post_without_login("/account/reset_user_passwd", Box::new(account_controller::reset_user_password)), Route::post("/account/export_data", Box::new(account_controller::export_data)), + Route::post("/account/delete", Box::new(account_controller::delete_account)), // User controller Route::post_without_login("/user/getInfo", Box::new(user_controller::get_single)),