mirror of
https://gitlab.linphone.org/BC/public/flexisip-account-manager.git
synced 2026-05-07 05:53:07 +00:00
Added default algo setting
This commit is contained in:
parent
94419027cf
commit
0f24b04ba9
2 changed files with 11 additions and 3 deletions
|
|
@ -29,6 +29,13 @@ define("GENERATED_PASSWORD_CHARACTERS", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklm
|
|||
*/
|
||||
define("GENERATED_PASSWORD_LENGTH", 8);
|
||||
|
||||
/*
|
||||
* The default algorithm to use if not specified in the request
|
||||
*
|
||||
* Default value: MD5
|
||||
*/
|
||||
define("DEFAULT_ALGORITHM", "MD5");
|
||||
|
||||
/*
|
||||
* If set to True, a created account will automatically be activated and it's expiration date set to now + TRIAL_DURATION_DAYS,
|
||||
* otherwise expiration date for trial will be set when account is activated via a different xml rpc call.
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ function check_parameter($param, $param_name = "username") {
|
|||
|
||||
function get_algo($algo) {
|
||||
if ($algo == NULL || $algo == "") {
|
||||
Logger::getInstance()->warning("Algo parameter wasn't found, assume MD5");
|
||||
return "MD5";
|
||||
Logger::getInstance()->warning("Algo parameter wasn't found, assume " . DEFAULT_ALGORITHM);
|
||||
return DEFAULT_ALGORITHM;
|
||||
}
|
||||
if ($algo == "MD5" || $algo == "SHA-256" || $algo == "clrtxt") {
|
||||
return $algo;
|
||||
|
|
@ -100,7 +100,8 @@ function get_lang($param) {
|
|||
function hash_password($user, $password, $domain, $algo) {
|
||||
$hashed_password = $password;
|
||||
if ($algo == "" || $algo == "MD5") $hashed_password = hash("md5", $user . ":" . $domain . ":" . $password);
|
||||
if ($algo == "SHA-256") $hashed_password = hash("sha256", $user . ":" . $domain . ":" . $password);
|
||||
else if ($algo == "SHA-256") $hashed_password = hash("sha256", $user . ":" . $domain . ":" . $password);
|
||||
else Logger::getInstance()->error("Algorithm not supported: " . $algo);
|
||||
return $hashed_password;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue