1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-20 16:35:17 +00:00

Start to implement data export

This commit is contained in:
2020-07-13 18:56:36 +02:00
parent ded88474d5
commit f21636aa4e
5 changed files with 35 additions and 1 deletions

View File

@ -25,6 +25,7 @@ use crate::utils::pdf_utils::is_valid_pdf;
use crate::utils::string_utils::{check_string_before_insert, check_url, remove_html_nodes};
use crate::utils::user_data_utils::{generate_new_user_data_file_name, prepare_file_creation, user_data_path};
use crate::utils::virtual_directories_utils::check_virtual_directory;
use crate::constants::PASSWORD_MIN_LENGTH;
/// Http request handler
///
@ -659,4 +660,15 @@ impl HttpRequestHandler {
Ok(remove_html_nodes(&content))
}
/// Check the password of the current user
pub fn need_user_password(&mut self, field: &str) ->ResultBoxError {
let password = self.post_string_opt(field, PASSWORD_MIN_LENGTH, true)?;
if !account_helper::check_user_password(self.user_id_ref()?, &password)? {
self.forbidden("Invalid password!".to_string())?;
}
Ok(())
}
}