<?php
/***************************************************************************
- * Copyright (C) 2003-2011 Polytechnique.org *
+ * Copyright (C) 2003-2014 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
'index' => $this->make_hook('index', AUTH_PUBLIC),
'exit' => $this->make_hook('exit', AUTH_PUBLIC),
+ 'login' => $this->make_hook('login', AUTH_COOKIE, 'groups'),
'admin' => $this->make_hook('admin', AUTH_PASSWD, 'admin'),
'groups' => $this->make_hook('groups', AUTH_PUBLIC),
'groupes.php' => $this->make_hook('groups2', AUTH_PUBLIC),
);
}
+ function handler_login()
+ {
+ // We require different credentials for '/login/' ("groups" instead of "user").
+ // We have to redirect the call to the actual CoreModule->handler_login.
+ $args = func_get_args();
+ return call_user_func_array(array("CoreModule", "handler_login"), $args);
+ }
+
function handler_photo($page, $x = null)
{
if (!$x || !($profile = Profile::get($x))) {
}
}
+ require_once 'emails.inc.php';
+ require_once 'name.func.inc.php';
+
// Update user info
- $full_name = Post::t('firstname') . ' ' . Post::t('lastname');
- $directory_name = mb_strtoupper(Post::t('lastname')) . ' ' . Post::t('firstname');
+ $lastname = capitalize_name(Post::t('lastname'));
+ $firstname = capitalize_name(Post::t('firstname'));
+ $full_name = build_full_name($firstname, $lastname);
+ $directory_name = build_directory_name($firstname, $lastname);
+ $sort_name = build_sort_name($firstname, $lastname);
XDB::query('UPDATE accounts
- SET full_name = {?}, directory_name = {?}, display_name = {?},
- firstname = {?}, lastname = {?}, sex = {?}, email = {?}
+ SET full_name = {?}, directory_name = {?}, sort_name = {?}, display_name = {?},
+ firstname = {?}, lastname = {?}, sex = {?}
WHERE uid = {?}',
- $full_name, $directory_name, Post::t('display_name'),
+ $full_name, $directory_name, $sort_name, Post::t('display_name'),
Post::t('firstname'), Post::t('lastname'),
- (Post::t('sex') == 'male') ? 'male' : 'female', Post::t('email'), $user->id());
- if (XDB::affectedRows()) {
- require_once 'emails.inc.php';
- if (require_email_update($user, Post::t('email'))) {
+ (Post::t('sex') == 'male') ? 'male' : 'female', $user->id());
+
+ // Updates email.
+ $new_email = strtolower(Post::t('email'));
+ if (require_email_update($user, $new_email)) {
+ XDB::query('UPDATE accounts
+ SET email = {?}
+ WHERE uid = {?}',
+ $new_email, $user->id());
$listClient = new MMList(S::user());
- $listClient->change_user_email($user->forlifeEmail(), Post::t('email'));
- update_alias_user($user->forlifeEmail(), Post::t('email'));
- }
- $user = User::getWithUID($user->id());
- S::set('user', $user);
- $page->trigSuccess('Données mises à jour.');
+ $listClient->change_user_email($user->forlifeEmail(), $new_email);
+ update_alias_user($user->forlifeEmail(), $new_email);
}
+ $user = User::getWithUID($user->id());
+ S::set('user', $user);
+ $page->trigSuccess('Données mises à jour.');
}
$page->addJsLink('password.js');
}
}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
?>