<?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 *
}
return array(
- 'googleapps' => $this->make_hook('index', AUTH_MDP, 'mail'),
- 'admin/googleapps' => $this->make_hook('admin', AUTH_MDP, 'admin'),
- 'admin/googleapps/job' => $this->make_hook('admin_job', AUTH_MDP, 'admin'),
- 'admin/googleapps/user' => $this->make_hook('admin_user', AUTH_MDP, 'admin'),
+ 'googleapps' => $this->make_hook('index', AUTH_PASSWD, 'gapps'),
+ 'admin/googleapps' => $this->make_hook('admin', AUTH_PASSWD, 'admin'),
+ 'admin/googleapps/job' => $this->make_hook('admin_job', AUTH_PASSWD, 'admin'),
+ 'admin/googleapps/user' => $this->make_hook('admin_user', AUTH_PASSWD, 'admin'),
);
}
// Fills up the 'is Google Apps redirection active' variable.
$redirect_active = false;
$redirect_unique = true;
+ $gapps_email = '';
if ($account->active()) {
$redirect = new Redirect($user);
foreach ($redirect->emails as $email) {
if ($email->type == 'googleapps') {
+ $gapps_email = $email->email;
$redirect_active = $email->active;
$redirect_unique = !$redirect->other_active($email->email);
}
S::assert_xsrf_token();
if (Post::v('pwsync') == 'sync') {
$account->set_password_sync(true);
- $account->set_password(S::v('password'));
+ $account->set_password($user->password());
} else {
$account->set_password_sync(false);
}
if ($account->pending_update_suspension) {
$page->trigWarning("Ton compte est déjà en cours de désactivation.");
} else {
- if ($redirect->modify_one_email('googleapps', false) == SUCCESS) {
+ if (!$redirect_active || $redirect->modify_one_email($gapps_email, false) == SUCCESS) {
$account->suspend();
$page->trigSuccess("Ton compte Google Apps est dorénavant désactivé.");
} else {
}
}
-// 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:
?>