Use get_config_value to ensure that geoloc accounts are disabled if there is no config value

This commit is contained in:
Peio Rigaux 2020-08-25 11:58:11 +02:00
parent a7f20f59b9
commit b102db7fe4
5 changed files with 7 additions and 7 deletions

View file

@ -8,7 +8,7 @@
#%define _datadir %{_datarootdir}
#%define _docdir %{_datadir}/doc
%define build_number 24
%define build_number 25
%define var_dir /var/opt/belledonne-communications
%define opt_dir /opt/belledonne-communications/share/flexisip-account-manager
%define env_file "$RPM_BUILD_ROOT/etc/flexisip-account-manager/flexiapi.env"

View file

@ -44,7 +44,7 @@ function update_account_user_info($username, $ha1, $firstname, $lastname, $gende
$user_info = new UserInfo($db);
$user_info->account_id = $account->id;
if (ENABLE_NEW_ACCOUNTS_GEOLOC) {
if (get_config_value(ENABLE_NEW_ACCOUNTS_GEOLOC, FALSE)) {
Logger::getInstance()->debug("userInfo : Account ip after enable geoloc if " . $account->ip_address);
$country_infos = Geoloc::getGeolocInfosFromIp($account->ip_address);
if ($country_infos) {

View file

@ -126,7 +126,7 @@ class UserInfo
{
$query = "INSERT INTO " . USER_INFO_DB_TABLE . " SET account_id=:account_id, firstname=:firstname, lastname=:lastname, gender=:gender, subscribe=:subscribe";
if (ENABLE_NEW_ACCOUNTS_GEOLOC) {
if (get_config_value(ENABLE_NEW_ACCOUNTS_GEOLOC, FALSE)) {
$query .= ", country_code=:country_code, country_name=:country_name";
}
@ -145,7 +145,7 @@ class UserInfo
$stmt->bindParam(":gender", $this->gender);
$stmt->bindParam(":subscribe", $this->subscribe);
if (ENABLE_NEW_ACCOUNTS_GEOLOC) {
if (get_config_value(ENABLE_NEW_ACCOUNTS_GEOLOC, FALSE)) {
$this->country_code = htmlspecialchars(strip_tags($this->country_code));
$this->country_name = htmlspecialchars(strip_tags($this->country_name));

View file

@ -104,7 +104,7 @@ function xmlrpc_create_email_account($method, $args)
//need username + domain
//We call this function to set the geoloc if enabled
if (ENABLE_NEW_ACCOUNTS_GEOLOC) {
if (get_config_value(ENABLE_NEW_ACCOUNTS_GEOLOC, FALSE)) {
return update_account_user_info($account->username, $hashed_password, null, null, "unknown", '0', $account->domain, $algo);
}
@ -189,7 +189,7 @@ function xmlrpc_create_email_md5_sha256_account($method, $args)
//We call this function to set the geoloc if enabled
// args needed = [username, ha1, firstname, lastname, gender, subscribe, [domain], [algo]]
//need username + domain
if (ENABLE_NEW_ACCOUNTS_GEOLOC) {
if (get_config_value(ENABLE_NEW_ACCOUNTS_GEOLOC, FALSE)) {
return update_account_user_info($account->username, $md5_hash, null, null, "unknown", '0', $account->domain, MD5);
}

View file

@ -137,7 +137,7 @@ function xmlrpc_create_phone_account($method, $args)
//We call this function to set the geoloc if enabled
// args needed = [username, ha1, firstname, lastname, gender, subscribe, [domain], [algo]]
//need username + domain
if (ENABLE_NEW_ACCOUNTS_GEOLOC) {
if (get_config_value(ENABLE_NEW_ACCOUNTS_GEOLOC, FALSE)) {
return update_account_user_info($account->username, $hashed_password, null, null, "unknown", '0', $account->domain, $algo);
}