1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-26 07:19:22 +00:00

Apply new first and last name restrictions

This commit is contained in:
Pierre HUBERT 2021-04-16 07:40:28 +02:00
parent ff8a862221
commit 2f2ecdb444
2 changed files with 6 additions and 4 deletions

View File

@ -9,6 +9,7 @@ use crate::api_data::res_check_security_answers::ResCheckSecurityAnswers;
use crate::api_data::res_check_security_questions_exists::ResCheckSecurityQuestionsExists; use crate::api_data::res_check_security_questions_exists::ResCheckSecurityQuestionsExists;
use crate::api_data::res_get_security_questions::ResGetSecurityQuestions; use crate::api_data::res_get_security_questions::ResGetSecurityQuestions;
use crate::api_data::user_mail_address::UserMailAddressAPI; use crate::api_data::user_mail_address::UserMailAddressAPI;
use crate::constants::accounts_info_policy::{MIN_FIRST_NAME_LENGTH, MIN_LAST_NAME_LENGTH};
use crate::constants::PASSWORD_RESET_TOKEN_LENGTH; use crate::constants::PASSWORD_RESET_TOKEN_LENGTH;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::error::ResultBoxError; use crate::data::error::ResultBoxError;
@ -55,8 +56,8 @@ pub fn create(r: &mut HttpRequestHandler) -> RequestResult {
} }
let new_account = NewAccount { let new_account = NewAccount {
first_name: r.post_content("firstName", 3, true)?, first_name: r.post_content("firstName", MIN_FIRST_NAME_LENGTH as usize, true)?,
last_name: r.post_content("lastName", 3, true)?, last_name: r.post_content("lastName", MIN_LAST_NAME_LENGTH as usize, true)?,
email, email,
password: r.post_string_opt("password", 3, true)?, password: r.post_string_opt("password", 3, true)?,
}; };

View File

@ -10,6 +10,7 @@ use crate::api_data::notification_settings_api::NotificationSettingsAPI;
use crate::api_data::res_create_custom_emoji::ResCreateCustomEmoji; use crate::api_data::res_create_custom_emoji::ResCreateCustomEmoji;
use crate::api_data::security_settings_api::SecuritySettingsAPI; use crate::api_data::security_settings_api::SecuritySettingsAPI;
use crate::constants::{conservation_policy, SUPPORTED_LANGUAGES}; use crate::constants::{conservation_policy, SUPPORTED_LANGUAGES};
use crate::constants::accounts_info_policy::{MIN_FIRST_NAME_LENGTH, MIN_LAST_NAME_LENGTH};
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::general_settings::GeneralSettings; use crate::data::general_settings::GeneralSettings;
use crate::data::http_request_handler::HttpRequestHandler; use crate::data::http_request_handler::HttpRequestHandler;
@ -45,8 +46,8 @@ pub fn set_general(r: &mut HttpRequestHandler) -> RequestResult {
let new_settings = GeneralSettings { let new_settings = GeneralSettings {
id: r.user_id()?, id: r.user_id()?,
first_name: r.post_content("firstName", 3, true)?, first_name: r.post_content("firstName", MIN_FIRST_NAME_LENGTH as usize, true)?,
last_name: r.post_content("lastName", 3, true)?, last_name: r.post_content("lastName", MIN_LAST_NAME_LENGTH as usize, true)?,
page_status, page_status,
block_comments: !r.post_bool("allowComments")?, block_comments: !r.post_bool("allowComments")?,
allow_posts_from_friends: r.post_bool("allowPostsFromFriends")?, allow_posts_from_friends: r.post_bool("allowPostsFromFriends")?,