* Updates GApps passwords on password change (for synchronized accounts).
* Disables GApps accounts on user deletion/death/deactivation.
Signed-off-by: Vincent Zanotti <vincent.zanotti@polytechnique.org>
- New PlProfiler tool -FRU
- Integration of goodies/external tools with local rss/iCal -VZA
- iGoogle gadgets for latest events and directory search -VZA
+ - Integration of Google Apps accounts -VZA
* Emails:
- Imap mail storage can be activated/deactivated from interface -VZA
$mmlist = new MMList(S::v('uid'), S::v('password'));
$mmlist->kill($alias, $really_del);
+
+ // Deactivates, when available, the Google Apps account of the user.
+ if ($globals->mailstorage->googleapps_domain) {
+ require_once 'googleapps.inc.php';
+ $account = new GoogleAppsAccount($uid, $alias);
+ $account->suspend();
+ }
}
// }}}
function handler_user(&$page, $login = false)
{
+ global $globals;
$page->changeTpl('admin/utilisateurs.tpl');
$page->assign('xorg_title','Polytechnique.org - Administration - Edit/Su/Log');
require_once("emails.inc.php");
LEFT JOIN aliases AS a ON (a.id = u.user_id AND type= 'a_vie')
WHERE u.user_id = {?}", $mr['user_id']);
$mr = $r->fetchOneAssoc();
+
+ // If GoogleApps is enabled, the user did choose to use synchronized passwords,
+ // and the password was changed, updates the Google Apps password as well.
+ if ($globals->mailstorage->googleapps_domain && Env::v('newpass_clair') != "********") {
+ require_once 'googleapps.inc.php';
+ $account = new GoogleAppsAccount($mr['user_id'], $mr['forlife']);
+ if ($account->g_status == 'active' && $account->sync_password) {
+ $account->set_password($pass_encrypted);
+ }
+ }
+
+ // If GoogleApps is enabled, and the user is now disabled, disables the Google Apps account as well.
+ if ($globals->mailstorage->googleapps_domain &&
+ $new_fields['perms'] == 'disabled' &&
+ $new_fields['perms'] != $old_fields['perms']) {
+ require_once 'googleapps.inc.php';
+ $account = new GoogleAppsAccount($mr['user_id'], $mr['forlife']);
+ $account->suspend();
+ }
break;
// DELETE FROM auth_user_md5
if ($action == 'password') {
if ($subaction == 'sync') {
$account->set_password_sync(true);
- $account->set_password($_SESSION['password']);
+ $account->set_password(S::v('password'));
$page->trig("Ton mot de passe Google Apps sera dorénavant synchronisé avec ton mot de passe Polytechnique.org.");
} else if ($subaction == 'nosync') {
$account->set_password_sync(false);
$password_sync = Post::b('password_sync');
$redirect_mails = Post::b('redirect_mails');
if ($password_sync) {
- $password = $_SESSION['password'];
+ $password = S::v('password');
} else {
$password = Post::v('response2');
}
function handler_password(&$page)
{
+ global $globals;
+
if (Post::has('response2')) {
require_once 'secure_hash.inc.php';
WHERE user_id={?}', $password,
S::v('uid'));
+ // If GoogleApps is enabled, and the user did choose to use synchronized passwords,
+ // updates the Google Apps password as well.
+ if ($globals->mailstorage->googleapps_domain) {
+ require_once 'googleapps.inc.php';
+ $account = new GoogleAppsAccount(S::v('uid'), S::v('forlife'));
+ if ($account->g_status == 'active' && $account->sync_password) {
+ $account->set_password($password);
+ }
+ }
+
$log =& S::v('log');
$log->log('passwd', '');
function handler_tmpPWD(&$page, $certif = null)
{
+ global $globals;
XDB::execute('DELETE FROM perte_pass
WHERE DATE_SUB(NOW(), INTERVAL 380 MINUTE) > created');
$uid = $ligne["uid"];
if (Post::has('response2')) {
$password = Post::v('response2');
- $logger = new CoreLogger($uid);
XDB::query('UPDATE auth_user_md5 SET password={?}
WHERE user_id={?} AND perms IN("admin","user")',
$password, $uid);
XDB::query('DELETE FROM perte_pass WHERE certificat={?}', $certif);
+
+ // If GoogleApps is enabled, and the user did choose to use synchronized passwords,
+ // updates the Google Apps password as well.
+ if ($globals->mailstorage->googleapps_domain) {
+ require_once 'googleapps.inc.php';
+ require_once 'user.func.inc.php';
+ $forlife = get_user_forlife($uid, '_silent_user_callback');
+ $account = new GoogleAppsAccount($uid, $forlife);
+ if ($account->g_status == 'active' && $account->sync_password) {
+ $account->set_password($password);
+ }
+ }
+
+ $logger = new CoreLogger($uid);
$logger->log("passwd","");
$page->changeTpl('platal/tmpPWD.success.tpl');
} else {
function handler_success(&$page)
{
+ global $globals;
$page->changeTpl('register/success.tpl');
$_SESSION['sub_state'] = array('step' => 5);
WHERE user_id={?}', $password,
S::v('uid'));
+ // If GoogleApps is enabled, and the user did choose to use synchronized passwords,
+ // and if the (stupid) user has decided to user /register/success another time,
+ // updates the Google Apps password as well.
+ if ($globals->mailstorage->googleapps_domain) {
+ require_once 'googleapps.inc.php';
+ $account = new GoogleAppsAccount(S::v('uid'), S::v('forlife'));
+ if ($account->g_status == 'active' && $account->sync_password) {
+ $account->set_password($password);
+ }
+ }
+
$log = S::v('log');
$log->log('passwd', '');