From dd6ace0c0c14a12f36e7063d4d37831fe8cfa912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=EF=BF=BD=EF=BF=BD?= Date: Wed, 18 Jun 2014 15:24:38 +0000 Subject: [PATCH] don't create piwik accounts with random gmail addresses, properly prefix the accounts so they're unique --- bureau/class/m_piwik.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bureau/class/m_piwik.php b/bureau/class/m_piwik.php index 6d776261..982fdf1c 100644 --- a/bureau/class/m_piwik.php +++ b/bureau/class/m_piwik.php @@ -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)); }