From d05cf8d4ad0bba8aa4e053ede5f9dccb9b0c88fa Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Fri, 18 Mar 2011 22:38:40 +0100 Subject: [PATCH] Renames domain value for users loging with their hruid. Ensures the rigth username is suggested to them. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- classes/xorgsession.php | 2 +- plugins/insert.getUserName.php | 13 ++++++++++--- templates/core/password_prompt.tpl | 2 +- templates/platal/password.tpl | 2 +- templates/xnet/login.tpl | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/classes/xorgsession.php b/classes/xorgsession.php index 25ade0d..400f809 100644 --- a/classes/xorgsession.php +++ b/classes/xorgsession.php @@ -148,7 +148,7 @@ class XorgSession extends PlSession WHERE email = {?} AND type = \'alias_aux\'', $uname); $loginType = 'uid'; - } else if (Post::s('domain') == "ax") { + } else if (Post::s('domain') == 'hruid') { $login = $uname; $loginType = 'hruid'; } else { diff --git a/plugins/insert.getUserName.php b/plugins/insert.getUserName.php index e8172fe..ce34a96 100644 --- a/plugins/insert.getUserName.php +++ b/plugins/insert.getUserName.php @@ -28,15 +28,22 @@ function smarty_insert_getUsername() return ''; } - if (Cookie::v('domain', 'login') != 'alias') { + $domain = Cookie::v('domain', 'login'); + if ($domain == 'hruid') { + return XDB::fetchOneCell('SELECT hruid + FROM accounts + WHERE uid = {?}', + $id); + } elseif ($domain == 'alias') { return XDB::fetchOneCell('SELECT email FROM email_source_account - WHERE uid = {?} AND type != \'alias_aux\' AND FIND_IN_SET(\'bestalias\', flags)', + WHERE uid = {?} AND type = \'alias_aux\'', $id); } else { return XDB::fetchOneCell('SELECT email FROM email_source_account - WHERE uid = {?} AND type = \'alias_aux\'', + WHERE uid = {?} AND type != \'alias_aux\' + ORDER BY NOT FIND_IN_SET(\'bestalias\', flags), MIN(email)', $id); } diff --git a/templates/core/password_prompt.tpl b/templates/core/password_prompt.tpl index a7e3a6b..6975a2c 100644 --- a/templates/core/password_prompt.tpl +++ b/templates/core/password_prompt.tpl @@ -56,7 +56,7 @@ - diff --git a/templates/platal/password.tpl b/templates/platal/password.tpl index 02cdee2..94dd077 100644 --- a/templates/platal/password.tpl +++ b/templates/platal/password.tpl @@ -68,7 +68,7 @@ - + strictement personnelle'} colspan="2"> diff --git a/templates/xnet/login.tpl b/templates/xnet/login.tpl index f92b8cb..749c243 100644 --- a/templates/xnet/login.tpl +++ b/templates/xnet/login.tpl @@ -28,7 +28,7 @@ Identifiant : - + -- 2.1.4