Exemplo n.º 1
0
def accept_guest(request,user_id):
    u = User.objects.get(id=user_id)
    u.is_active = True
    pwd = User.objects.make_random_password()
    u.set_password(pwd)
    u.save()
    template_mail(
        'Guest account Acceptance',
        'admin/memberinfo/guest_accept_email',
        {'name':u.username,'password':pwd},
        COMPSOC_EXEC_EMAIL,
        [u.email])
    return HttpResponseRedirect('/admin/memberinfo/guests/')
Exemplo n.º 2
0
 def handle(self, *args, **options):
     '''
     '''
     u = User.objects.get(username=args[0])
     password = User.objects.make_random_password()
     u.set_password(password)
     u.save()
     template_mail(
         'New Website Password',
         'memberinfo/new_user_email',
         {'first': u.first_name, 'last':u.last_name, 'username':u.username, 'password':password},
         COMPSOC_TECHTEAM_EMAIL,
         [u.email])
Exemplo n.º 3
0
def reject_guest(request,user_id):
    u = User.objects.get(id=user_id)
    name = u.username
    email = u.email
    
    u.member.delete()
    u.nicknamedetails.delete()
    u.delete()
    
    template_mail(
        'Guest account Rejection',
        'admin/memberinfo/guest_reject_email',
        {'name':name},
        COMPSOC_EXEC_EMAIL,
        [email])

    return HttpResponseRedirect('/admin/memberinfo/guests/')
Exemplo n.º 4
0
 def handle(self, *args, **options):
     """
     """
     for u in User.objects.all():
         password = User.objects.make_random_password()
         u.set_password(password)
         u.save()
         try:
             template_mail(
                 "New Website Password",
                 "memberinfo/migration_email",
                 {"first": u.first_name, "last": u.last_name, "username": u.username, "password": password},
                 COMPSOC_TECHTEAM_EMAIL,
                 [u.email],
             )
         except Exception, e:
             print u.username
             print e
Exemplo n.º 5
0
def ticket_email(sender, **kwargs):
    '''
    Emails appropriate people on ticket changes
    '''
    p = Ticket.objects.get(pk=sender.id)
    email_to = set()
    for ticket in [sender,p]:
        if ticket.assignee:
            email_to.add(ticket.assignee.email)
        email_to.add(ticket.submitter.email)
        email_to.add(ticket.goal.supervisor.email)
    template_mail(
        'Ticket Changed',
        'tracker/ticket_change_email',
        {'attr':dict_map(lambda x: diff(sender,p,x),p.__dict__.keys())},
        COMPSOC_EXEC_EMAIL,
        [x for x in email_to],
    )
Exemplo n.º 6
0
def goal_email(sender, **kwargs):
    '''
    Emails supervisor of goal on any changes
    '''
    p = Goal.objects.get(pk=sender.id)
    email = diff(send,p,'supervisor')
    if email:
        template_mail(
            'Goal Ownership Changed',
            'tracker/goal_owner_email',
            {'from':sender.supervisor,'to':p.supervisor,'name':sender.name},
            COMPSOC_EXEC_EMAIL,
            [sender.supervisor.email,p.supervisor.email],
        )
    else:
        template_mail(
            'Goal Changed',
            'tracker/goal_change_email',
            {'attr':dict_map(lambda x:diff(sender,p,x),p.__dict__.keys()),'name':sender.name},
            COMPSOC_EXEC_EMAIL,
            [sender.supervisor.email],
        )