Project

General

Profile

« Previous | Next » 

Revision 458742b3

Added by Thomas Noël over 12 years ago

[ezldap] mail to admins when creating a user

ticket #650 http://dev.entrouvert.org/issues/650

View differences:

extra/modules/ezldap_ui.ptl
62 62
    ldap_conn.modify_s(dn, mod_list)
63 63
    return token
64 64

  
65
def email_to_admins(dn, template):
66
    admins = [x for x in get_publisher().user_class.select() if x.is_admin]
67
    if not admins:
68
        return
69
    admin_emails = [x.email for x in admins if x.email]
70

  
71
    user = ezldap.EzLdapUser(dn)
72
    data = {
73
        'hostname': get_request().get_server(),
74
        'username': user.email,
75
        'email_as_username': 'True',
76
        'name': user.display_name,
77
        'email': user.email,
78
    }
79
    get_publisher().substitutions.feed(user)
80

  
81
    emails.custom_ezt_email(template, data,
82
            admin_emails, fire_and_forget = True)
83

  
84

  
65 85
class EzMyspaceDirectory(MyspaceDirectory):
66 86

  
67 87
    def __init__(self):
......
199 219
                    (ldap.MOD_DELETE, 'tokenAction', None),
200 220
                    (ldap.MOD_DELETE, 'tokenExpiration', None)]
201 221
            ezldap.get_ldap_conn().modify_s(dn, mod_list)
222
            email_to_admins(dn, 'new-registration-admin-notification')
202 223
            template.html_top(_('Welcome'))
203 224
            return TextsDirectory.get_html_text('account-created')
204 225
        elif action == 'change_email':

Also available in: Unified diff