コード例 #1
0
ファイル: forms.py プロジェクト: vitorh45/exemplos
    def save(self, commit=True, invite_token=None, site=None):
        user = super(UserCreationForm, self).save(commit=False)
        user.username = user.email
        user.set_password(self.cleaned_data["password1"])
        if commit:
            user.save()

        # save zipcode in userprofile
        user_profile, created = UserMeuClick.objects.get_or_create(user=user)
        user_profile.name = self.cleaned_data["name"]
        user_profile.creation_date = datetime.now()
        salt = hashlib.sha1(str(random.random())).hexdigest()[:5]
        token = hashlib.sha1(salt + user.username).hexdigest()
        user_profile.token = token
        user_profile.save()

        # sending the email activation
        domain = Site.objects.get_current().domain
        titulo = u"ClickPB - email de ativação de cadastro"
        destino = (user.email, )
        texto = u"Clique no link abaixo para a ativação do seu cadastro no ClickPB\n"
        if not domain.startswith("http://"):
            domain = "http://" + domain
        if not domain.endswith("/"):
            domain = domain + "/"
        texto += u"%svcnoclick/cadastro/ativacao/%s" % (domain, token)

        celery_send_email.apply_async(
            args=[titulo, texto, "*****@*****.**", destino],
            priority=0)
        #EmailThread(titulo, texto, "*****@*****.**",destino).start()
        #send_mail(subject=titulo,message=texto,from_email="",recipient_list=destino,)
        # return user
        return user
コード例 #2
0
ファイル: forms.py プロジェクト: vitorh45/exemplos
    def save(self, commit=True, invite_token=None, site=None):
        user = super(UserCreationForm, self).save(commit=False)
        user.username = user.email
        user.set_password(self.cleaned_data["password1"])
        if commit:
            user.save()

        # save zipcode in userprofile
        user_profile, created = UserMeuClick.objects.get_or_create(
                    user=user)
        user_profile.name = self.cleaned_data["name"]
        user_profile.creation_date = datetime.now()
        salt = hashlib.sha1(str(random.random())).hexdigest()[:5]
        token = hashlib.sha1(salt+user.username).hexdigest()
        user_profile.token = token
        user_profile.save()

        # sending the email activation
        domain = Site.objects.get_current().domain
        titulo = u"ClickPB - email de ativação de cadastro"
        destino = (user.email,)
        texto = u"Clique no link abaixo para a ativação do seu cadastro no ClickPB\n"
        if not domain.startswith("http://"):
            domain = "http://"+domain
        if not domain.endswith("/"):
            domain = domain + "/"
        texto += u"%svcnoclick/cadastro/ativacao/%s" % (domain,token)

        celery_send_email.apply_async(args=[titulo, texto, "*****@*****.**",destino], priority=0)
        #EmailThread(titulo, texto, "*****@*****.**",destino).start()
        #send_mail(subject=titulo,message=texto,from_email="",recipient_list=destino,)
        # return user
        return user
コード例 #3
0
ファイル: forms.py プロジェクト: vitorh45/exemplos
    def send_email_(self):
        # sending the email activation
        email = self.cleaned_data["email"]
        try:
            user = UserMeuClick.objects.get(user__email=email)
            token = user.token
        except:
            raise Http404()
        domain = Site.objects.get_current().domain
        titulo = u"ClickPB - email de reset da senha"
        destino = [email]
        texto = u"Clique no link abaixo para alterar sua senha no ClickPB\n"

        if not domain.startswith("http://"):
            domain = "http://"+domain
        if not domain.endswith("/"):
            domain = domain + "/"

        texto += u"%svcnoclick/cadastro/resetar-senha/%s" % (domain,token)

        #EmailThread(titulo, texto, "",destino).start()
        celery_send_email.apply_async(args=[titulo, texto, "*****@*****.**",destino], priority=0)
コード例 #4
0
ファイル: forms.py プロジェクト: vitorh45/exemplos
    def send_email_(self):
        # sending the email activation
        email = self.cleaned_data["email"]
        try:
            user = UserMeuClick.objects.get(user__email=email)
            token = user.token
        except:
            raise Http404()
        domain = Site.objects.get_current().domain
        titulo = u"ClickPB - email de reset da senha"
        destino = [email]
        texto = u"Clique no link abaixo para alterar sua senha no ClickPB\n"

        if not domain.startswith("http://"):
            domain = "http://" + domain
        if not domain.endswith("/"):
            domain = domain + "/"

        texto += u"%svcnoclick/cadastro/resetar-senha/%s" % (domain, token)

        #EmailThread(titulo, texto, "",destino).start()
        celery_send_email.apply_async(
            args=[titulo, texto, "*****@*****.**", destino],
            priority=0)