Example #1
0
    def _handle(self, *args, **options):
        sim = options['simulate']
        if sim:
            print "#### SIMULATION ONLY ####"

        if options['welcome_email']:
            print "Sending welcome email to '{}'".format(options['welcome_email'])
            email = options['welcome_email']
            user = CshcUser.objects.get(email=email)
            password = create_password(user, sim)
            user.is_active = False
            if not sim:
                user.save()
            reg_profile = create_profile(user, sim)
            # Email the user with their new password
            send_welcome_email_to_user(reg_profile, password, sim)
Example #2
0
    def _handle(self, *args, **options):
        sim = options['simulate']
        if sim:
            print "#### SIMULATION ONLY ####"

        # Get all users that don't have a password set.
        users = filter(lambda u: not u.has_usable_password(), CshcUser.objects.all())

        # For each user
        for u in users:
            password = create_password(u, sim)
            u.is_active = False
            if not sim:
                u.save()
            reg_profile = create_profile(u, sim)
            # Email the user with their new password
            send_welcome_email_to_user(reg_profile, password, sim)