This is possible only if the user email is not managed by the site (so for
user without the 'mail' permission). Changing the email update the
subscription in mailman.
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
+def change_user_email(userdesc, perms, vhost, from_email, to_email):
+ """ Change the email of a user
+ @root
+ """
+ from_email = from_email.lower()
+ to_email = to_email.lower()
+ for list in Utils.list_names():
+ try:
+ mlist = MailList.MailList(list, lock=0)
+ except:
+ continue
+ try:
+ mlist.Lock()
+ mlist.ApprovedChangeMemberAddress(from_email, to_email, 0)
+ mlist.Save()
+ mlist.Unlock()
+ except:
+ mlist.Unlock()
+ return 1
+
+
def create_list(userdesc, perms, vhost, listname, desc, advertise, modlevel, inslevel, owners, members):
""" Create a new list.
@root
def create_list(userdesc, perms, vhost, listname, desc, advertise, modlevel, inslevel, owners, members):
""" Create a new list.
@root
# create + del
server.register_function(get_all_lists)
server.register_function(get_all_user_lists)
# create + del
server.register_function(get_all_lists)
server.register_function(get_all_user_lists)
+server.register_function(change_user_email)
server.register_function(create_list)
server.register_function(delete_list)
# utilisateurs.php
server.register_function(create_list)
server.register_function(delete_list)
# utilisateurs.php
pl_redirect('admin/accounts');
}
pl_redirect('admin/accounts');
}
+ $listClient = new MMList(S::user());
$login = $user->login();
$registered = ($user->state != 'pending');
$login = $user->login();
$registered = ($user->state != 'pending');
if (Post::t('comment') != $user->comment) {
$to_update['comment'] = Post::blank('comment') ? null : Post::t('comment');
}
if (Post::t('comment') != $user->comment) {
$to_update['comment'] = Post::blank('comment') ? null : Post::t('comment');
}
+ if (!$user->checkPerms(User::PERM_MAIL) && Post::t('email') != $user->forlifeEmail()) {
+ $to_update['email'] = Post::t('email');
+ $listClient->change_user_email($user->forlifeEmail(), Post::t('email'));
+ }
}
if (!empty($to_update)) {
$res = XDB::query('SELECT *
}
if (!empty($to_update)) {
$res = XDB::query('SELECT *
$diff[$k] = array($oldValues[$k], trim($value, "'"));
unset($oldValues[$k]);
}
$diff[$k] = array($oldValues[$k], trim($value, "'"));
unset($oldValues[$k]);
}
- XDB::execute('UPDATE accounts
- SET ' . implode(', ', $set) . '
- WHERE uid = ' . XDB::format('{?}', $user->id()));
+ XDB::rawExecute('UPDATE accounts
+ SET ' . implode(', ', $set) . '
+ WHERE uid = ' . XDB::format('{?}', $user->id()));
$page->trigSuccess('Données du compte mise à jour avec succès');
$user = User::getWithUID($user->id());
$page->trigSuccess('Données du compte mise à jour avec succès');
$user = User::getWithUID($user->id());
$page->assign('host', $host);
// Display mailing lists
$page->assign('host', $host);
// Display mailing lists
- $list = new MMList(S::user());
- $page->assign('mlists', $list->get_all_user_lists($user->forlifeEmail()));
+ $page->assign('mlists', $listClient->get_all_user_lists($user->forlifeEmail()));
// Display active aliases.
$page->assign('virtuals', $user->emailAliases());
// Display active aliases.
$page->assign('virtuals', $user->emailAliases());
<label><input type="radio" name="sex" value="male" {if !$user->isFemale()}checked="checked"{/if} /> homme</label>
</td>
</tr>
<label><input type="radio" name="sex" value="male" {if !$user->isFemale()}checked="checked"{/if} /> homme</label>
</td>
</tr>
+ <tr>
+ <td class="titre">Email</td>
+ <td>{if $user->checkPerms('mail')}{$user->forlifeEmail()}{else}<input type="text" name="email" size="40" maxlength="255" value="{$user->forlifeEmail()}" />{/if}</td>
+ </tr>
<tr class="impair">
<td class="titre">Mot de passe</td>
<td>
<tr class="impair">
<td class="titre">Mot de passe</td>
<td>