From: Stéphane Jacob Date: Wed, 4 May 2011 14:58:33 +0000 (+0200) Subject: Merge branch 'xorg/master' into xorg/f/geocoding X-Git-Tag: xorg/1.1.2~62^2~31 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=cb6e7db980fcc5fcdd2dad5aa645cfdf98057cd4;hp=006158ff4b73f7f407e1cd6ed649a457cf989ffc;p=platal.git Merge branch 'xorg/master' into xorg/f/geocoding --- diff --git a/ChangeLog b/ChangeLog index e6308bb..6153d19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,10 +12,14 @@ Bug/Wish: - #1474: Provides accounts data for accounts without profile -JAC - #1476: Logs last use of Auth-Groupe-X keys -JAC + * Core: + - #1484: Fix reference to is_IE that does not exist anymore -FRU + * Emails: - #1110: Improves email combobox -JAC - #1459: Lists and administrates aliases on main domain -JAC - #1477: Fixes display and (de)activation of email storages -JAC + - #1479: Fixes display of corps in bounce list -JAC * Events: - #1475: Fixes date storage for next reminder -JAC diff --git a/bin/cron/cron_xnet_accounts.php b/bin/cron/cron_xnet_accounts.php index 96543ff..de935e0 100755 --- a/bin/cron/cron_xnet_accounts.php +++ b/bin/cron/cron_xnet_accounts.php @@ -37,7 +37,7 @@ $i = 0; foreach ($users as $user) { $mailer->setTo($user['email']); $mailer->assign('hash', $user['hash']); - $mailer->assign('hruid', $user['hruid']); + $mailer->assign('email', $user['email']); $mailer->assign('group', $user['group_name']); $mailer->assign('sender_name', $user['sender_name']); $mailer->send(); diff --git a/classes/xnetsession.php b/classes/xnetsession.php index 765ad5e..27ed4d8 100644 --- a/classes/xnetsession.php +++ b/classes/xnetsession.php @@ -35,11 +35,12 @@ class XnetSession extends XorgSession } if (!S::logged() && Post::has('auth_type') && Post::v('auth_type') == 'xnet' && !Post::has('wait')) { + $email = Post::v('username'); $type = XDB::fetchOneCell('SELECT type FROM accounts - WHERE hruid = {?}', - Post::v('username')); - if (!is_null($type) && $type != 'xnet') { + WHERE email = {?}', + $email); + if ((!is_null($type) && $type != 'xnet') || !User::isForeignEmailAddress($email)) { Platal::page()->trigErrorRedirect('Ce formulaire d\'authentification est réservé aux extérieurs à la communauté polytechnicienne.', ''); } diff --git a/classes/xorgsession.php b/classes/xorgsession.php index 400f809..815ad81 100644 --- a/classes/xorgsession.php +++ b/classes/xorgsession.php @@ -151,6 +151,15 @@ class XorgSession extends PlSession } else if (Post::s('domain') == 'hruid') { $login = $uname; $loginType = 'hruid'; + } else if ((Post::s('domain') == 'email')) { + $login = XDB::fetchOneCell('SELECT SQL_CALC_FOUND_ROWS uid + FROM accounts + WHERE email = {?}', + $uname); + if (!(XDB::fetchOneCell('SELECT FOUND_ROWS()') == 1)) { + $login =null; + } + $loginType = 'uid'; } else { $login = $uname; $loginType = is_numeric($uname) ? 'uid' : 'alias'; diff --git a/core b/core index 852e640..f759f38 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 852e6400e7b7dbc0c0d4c8b4e72ca009954056cb +Subproject commit f759f3804cfa1cba90b17baf9b6bd1f9617e0315 diff --git a/htdocs/javascript/xorg.js b/htdocs/javascript/xorg.js index 031e77b..47bf78b 100644 --- a/htdocs/javascript/xorg.js +++ b/htdocs/javascript/xorg.js @@ -179,7 +179,7 @@ function auto_links() { } if ((!href.contains(fqdn) && !this.className.contains('popup')) || node.hasClass('popup')) { node.click(function () { - window.open(href); + window.open(this.href); return false; }); } diff --git a/modules/carnet.php b/modules/carnet.php index aee2890..b813289 100644 --- a/modules/carnet.php +++ b/modules/carnet.php @@ -280,7 +280,7 @@ class CarnetModule extends PLModule } switch (Env::v('action')) { case 'retirer': - if (($contact = User::get(Env::v('user')))) { + if (($contact = Profile::get(Env::v('user')))) { if (XDB::execute("DELETE FROM contacts WHERE uid = {?} AND contact = {?}", $uid, $contact->id())) { @@ -291,7 +291,7 @@ class CarnetModule extends PLModule break; case 'ajouter': - if (($contact = User::get(Env::v('user')))) { + if (($contact = Profile::get(Env::v('user')))) { XDB::execute('INSERT IGNORE INTO contacts (uid, contact) VALUES ({?}, {?})', $uid, $contact->id()); diff --git a/modules/email.php b/modules/email.php index 41d4bf9..7648515 100644 --- a/modules/email.php +++ b/modules/email.php @@ -72,9 +72,10 @@ class EmailModule extends PLModule WHERE uid = {?} AND email = {?}", $user->id(), $email); XDB::execute('UPDATE accounts AS a INNER JOIN email_virtual_domains AS d ON (d.name = {?}) + INNER JOIN email_virtual_domains AS m ON (d.aliasing = m.id) SET a.best_domain = d.id - WHERE a.uid = {?}', - $domain, $user->id()); + WHERE a.uid = {?} AND m.name = {?}', + $domain, $user->id(), $user->mainEmailDomain()); // As having a non-null bestalias value is critical in // plat/al's code, we do an a posteriori check on the diff --git a/modules/profile/groups.inc.php b/modules/profile/groups.inc.php index 0f27bfd..f07a06c 100644 --- a/modules/profile/groups.inc.php +++ b/modules/profile/groups.inc.php @@ -114,7 +114,7 @@ class ProfilePageGroups extends ProfilePage FROM groups AS a INNER JOIN group_members AS m ON (m.asso_id = a.id) WHERE m.uid = {?} AND (a.cat = 'GroupesX' OR a.cat = 'Institutions')", - $this->pid())); + $this->owner->id())); $page->assign('listgroups', XDB::iterator("SELECT a.nom, a.diminutif, a.sub_url, IF (a.cat = 'Institutions', a.cat, d.nom) AS dom FROM groups AS a diff --git a/modules/register.php b/modules/register.php index bc54a13..48d37a8 100644 --- a/modules/register.php +++ b/modules/register.php @@ -373,6 +373,7 @@ class RegisterModule extends PLModule $user = User::getSilentWithUID($uid); $redirect = new Redirect($user); $redirect->add_email($email); + fix_bestalias($user); // Try to start a session (so the user don't have to log in); we will use // the password available in Post:: to authenticate the user. diff --git a/modules/xnet.php b/modules/xnet.php index bd95e38..803cfc8 100644 --- a/modules/xnet.php +++ b/modules/xnet.php @@ -269,7 +269,7 @@ class XnetModule extends PLModule Platal::session()->startAvailableAuth(); $page->changeTpl('xnet/register.success.tpl'); - $page->assign('hruid', $res['hruid']); + $page->assign('email', $res['email']); } else { $page->changeTpl('platal/password.tpl'); $page->assign('xnet', true); @@ -336,7 +336,7 @@ Email envoyé à " . Post::t('login')); $page->trigErrorRedirect("Cette adresse n'existe pas ou n'existe plus sur le serveur.", ''); } - $hruid = XDB::fetchOneCell('SELECT hruid + $email = XDB::fetchOneCell('SELECT email FROM accounts WHERE uid = {?}', $uid); @@ -359,11 +359,11 @@ Email envoyé à " . Post::t('login')); Platal::session()->startAvailableAuth(); $page->changeTpl('xnet/register.success.tpl'); - $page->assign('hruid', $hruid); + $page->assign('email', $email); } else { $page->changeTpl('platal/password.tpl'); $page->assign('xnet_reset', true); - $page->assign('hruid', $hruid); + $page->assign('email', $email); $page->assign('do_auth', 1); } } diff --git a/templates/include/minifiche.tpl b/templates/include/minifiche.tpl index 9752602..244ae3d 100644 --- a/templates/include/minifiche.tpl +++ b/templates/include/minifiche.tpl @@ -105,7 +105,7 @@ {/if} - {if hasPerm('admin') || $smarty.session.user->canEdit($profile)} + {if hasPerm('admin') || ($smarty.session.user->canEdit($profile) && !$smarty.session.user->isMe($user))}
[{if hasPerm('admin') && $hasowner}{if !$registered && !$dead} {* @@ -115,7 +115,8 @@ *}{icon name=wrench title="administrer user"}{/if}{* *}{if hasPerm('admin') || $smarty.session.user->canEdit($profile)}{* *}{* - *}{icon name=user_edit title="modifier la fiche"}{* + *}{icon name=user_edit title="modifier la fiche"}{/if}{* + *}{if hasPerm('admin,edit_directory')}{* *}{* *}{icon name=user_gray title="fiche AX"}{/if}]
diff --git a/templates/platal/password.tpl b/templates/platal/password.tpl index 5fb0c51..db20550 100644 --- a/templates/platal/password.tpl +++ b/templates/platal/password.tpl @@ -67,9 +67,9 @@ - + - + strictement personnelle'} colspan="2"> diff --git a/templates/xnet/account.mail.tpl b/templates/xnet/account.mail.tpl index 714a250..2cb632e 100644 --- a/templates/xnet/account.mail.tpl +++ b/templates/xnet/account.mail.tpl @@ -32,7 +32,7 @@ Bonjour, Après activation, vos paramètres de connexion seront : -identifiant : {$hruid} +identifiant : {$email} mot de passe : celui que vous choisirez Vous pouvez, dès à présent et pendant une période d'un mois, activer votre compte en cliquant sur le lien suivant : diff --git a/templates/xnet/login.tpl b/templates/xnet/login.tpl index 396f1ab..9356cb3 100644 --- a/templates/xnet/login.tpl +++ b/templates/xnet/login.tpl @@ -25,10 +25,10 @@
- + diff --git a/templates/xnet/recovery.tpl b/templates/xnet/recovery.tpl index fd337c9..de912f1 100644 --- a/templates/xnet/recovery.tpl +++ b/templates/xnet/recovery.tpl @@ -59,7 +59,7 @@ Si vous n'accéder pas à cet email dans les 6 heures, sollicitez un nouveau cer
Identifiant :Identifiant (adresse email) : - +
- Identifiant : + Identifiant (adresse email) : diff --git a/templates/xnet/register.success.tpl b/templates/xnet/register.success.tpl index f545dbf..b5ce382 100644 --- a/templates/xnet/register.success.tpl +++ b/templates/xnet/register.success.tpl @@ -30,7 +30,7 @@ profiter dès à présent des multiples fonctionnalités de Polytechnique.net.

- Pour rappel, votre identifiant est : {$hruid} + Pour rappel, votre identifiant est : {$email}

{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/upgrade/1.1.1/14_contacts.sql b/upgrade/1.1.1/14_contacts.sql new file mode 100644 index 0000000..10a965c --- /dev/null +++ b/upgrade/1.1.1/14_contacts.sql @@ -0,0 +1,8 @@ +ALTER TABLE contacts DROP FOREIGN KEY contacts_ibfk_2; +DELETE FROM contacts + WHERE NOT EXISTS (SELECT profiles.* + FROM profiles + WHERE profiles.pid = contacts.contact); +ALTER TABLE contacts ADD FOREIGN KEY (contact) REFERENCES profiles (pid) ON DELETE CASCADE ON UPDATE CASCADE; + +-- vim:set syntax=mysql: