示例#1
0
文件: forms.py 项目: neudesk/neucloud
 def register(self):
     data = self.cleaned_data
     tenant = self.cli.make_tenant(tenant_name=self.tenant_name(),
                                   description="Default Description",
                                   enabled=False)
     user = self.cli.make_user(name=data.get("email"),
                               password=data.get("password"),
                               email=data.get("email"),
                               tenant_id=tenant.id,
                               enabled=True)
     if user:
         url = "http://%s%s?token=%s" % (getattr(settings, 'OPENSTACK_APP_HOST', None),
                                         reverse_lazy("activate"),
                                         self.create_token(tenant.id))
         msg = """
         Please follow the link below to activate your account.<br />
         <a href='%s'>%s</a>
         """ % (url,
                url)
         mail = Mailer(subject="Activate",
                       message=msg,
                       fr=self.get_default_mail(),
                       recipients=[data['email']])
         mail.send()
     return user
示例#2
0
文件: forms.py 项目: neudesk/neucloud
 def send_mail(self, tenant_id):
     data = self.cleaned_data
     url = "http://%s%s?token=%s" % (getattr(settings, 'OPENSTACK_APP_HOST', None),
                                     reverse_lazy("activate"),
                                     self.create_token(tenant_id))
     msg = """
         Please follow the link below to activate your account.<br />
         <a href='%s'>%s</a>
         """ % (url, url)
     mail = Mailer(subject="Activate",
                   message=msg,
                   fr=self.get_default_mail(),
                   recipients=[data['email']])
     mail.send()
示例#3
0
文件: forms.py 项目: neudesk/neucloud
 def send_mail(self, subject, msg, to):
     mail = Mailer(subject=subject,
                   message=msg,
                   fr=self.get_default_mail(),
                   recipients=[to])
     return mail.send()