From 4b91231b7addc91bde41ed9b2ee90a3e036a36bf Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 2 Sep 2019 11:57:46 +0200 Subject: [PATCH] Added algo in activation link URL --- conf/emails.conf | 2 +- src/misc/email.php | 3 ++- src/xmlrpc/accounts_email.php | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/conf/emails.conf b/conf/emails.conf index c976607..6434e4d 100644 --- a/conf/emails.conf +++ b/conf/emails.conf @@ -19,7 +19,7 @@ define("EMAIL_SITE", "https://linphone.org"); /* * The link to open when click on activation - * It can have a %link% and an %username% parameter + * It can have a %link%, %username% and %algo% parameter * * Default value: www.linphone.org */ diff --git a/src/misc/email.php b/src/misc/email.php index 7b9e2fd..2fe432e 100644 --- a/src/misc/email.php +++ b/src/misc/email.php @@ -64,7 +64,7 @@ function send_email($email, $subject, $text, $html) { } } -function send_email_with_activation_link($email, $key, $username) { +function send_email_with_activation_link($email, $key, $username, $algo) { if( !EMAIL_ENABLED ){ Logger::getInstance()->warning("[EMAIL] Emails are disabled"); return "WARNING_EMAILS_DISABLED"; @@ -77,6 +77,7 @@ function send_email_with_activation_link($email, $key, $username) { $link = $pageURL . EMAIL_ACTIVATION_LINK; $link = str_replace("%key%", $key, $link); $link = str_replace("%username%", $username, $link); + $link = str_replace("%algo%", $algo, $link); Logger::getInstance()->debug("[EMAIL] Activation link is " . $link); $body = str_replace("%link%", $link, EMAIL_ACTIVATION_BODY); diff --git a/src/xmlrpc/accounts_email.php b/src/xmlrpc/accounts_email.php index 8f9107c..0ace833 100644 --- a/src/xmlrpc/accounts_email.php +++ b/src/xmlrpc/accounts_email.php @@ -88,7 +88,7 @@ function xmlrpc_create_email_account($method, $args) { } if (SEND_ACTIVATION_EMAIL && EMAIL_ENABLED) { - send_email_with_activation_link($email, $account->confirmation_key, $account->username); + send_email_with_activation_link($email, $account->confirmation_key, $account->username, $algo); } else if (AUTO_ACTIVATE_ACCOUNT) { //TODO /*if (USE_IN_APP_PURCHASES) { @@ -165,7 +165,7 @@ function xmlrpc_create_email_md5_sha256_account($method, $args) { } if (SEND_ACTIVATION_EMAIL && EMAIL_ENABLED) { - send_email_with_activation_link($email, $account->confirmation_key, $account->username); + send_email_with_activation_link($email, $account->confirmation_key, $account->username, SHA256); } else if (AUTO_ACTIVATE_ACCOUNT) { //TODO /*if (USE_IN_APP_PURCHASES) {