don't create piwik accounts with random gmail addresses, properly prefix the accounts so they're unique

This commit is contained in:
Antoine Beaupr�� 2014-06-18 15:24:38 +00:00
parent fb9d6d8457
commit dd6ace0c0c
1 changed files with 4 additions and 5 deletions

View File

@ -102,8 +102,7 @@ class m_piwik {
$user_login = $this->clean_user_name($user_login);
$user_pass = create_pass();
$user_mail = $user_mail ? $user_mail : $mem->user['mail'];
$user_mail = create_pass(4) . '@gmail.com'; // FIXME $user_mail; Unicité sur les emails ... Soit on ajoute + random soit, on prompt
$user_mail = $mem->user['mail'];
$user_alias = $user_login;
$api_data = $this->call_privileged_page('API', 'UsersManager.addUser', array('userLogin' => $user_login, 'password' => $user_pass, 'email' => $user_mail, 'alias' => $user_alias), 'JSON');
@ -345,10 +344,10 @@ class m_piwik {
/* Helper code FIXME: rename those function using "private" + "_" prefix */
/* return a clean username with a unique prefix per account */
function clean_user_name($username) {
return mysql_real_escape_string(trim($username));
global $admin, $cuid;
return 'alternc_' . $admin->get_login_by_uid($cuid) . '_' . mysql_real_escape_string(trim($username));
}