Example #1
0
 def form_valid(self, form):
     data = form.cleaned_data
     user = models.User(**data)
     user.save()
     content = 'Welcome to zufangbao! You have successed to sign up!'
     sendmessage(self.request, content)
     content = data['username'] + ' registration succeed!'
     utils.send_mail(data['email'], content)
     return utils.render('portal.html', {})
Example #2
0
 def form_valid(self, form):
     user = utils.get_user_obj(self.request)
     data = form.cleaned_data
     if user and data['email']:
         content = 'click here to active ' + \
                 '<a href="http://www.zufangbao.com/chargerent/">' \
                 'http://www.active.com</a>'
         utils.send_mail(data['email'], content)
         user.email = data['email']
         user.save()
         return safe(self.request)
     else:
     #LOG.debug("%s mailbox modify failed." % user)
         return utils.render('mailbox_modify.html',
                             {'errors': 'failed',
                              'form': form})
Example #3
0
 def form_valid(self, form):
     user = utils.get_user_obj(self.request)
     data = form.cleaned_data
     if user and data['email']:
         para = user.username
         content = 'click here to active ' + \
                 '<a href="http://localhost:8000/z/account/activate_mailbox/?username='******'">' + \
                 'http://www.active.com</a>'
         utils.send_mail(data['email'], content)    
         for i in range(120):
             time.sleep(1)
             user = utils.get_user_obj(self.request)
             if user.is_active == True: 
                 user.email = data['email']
                 user.is_active = False
                 user.save()
                 break
         return info(self.request)
     else:
     #LOG.debug("%s mailbox modify failed." % user)
         return utils.render('mailbox_modify.html',
                             {'errors': 'failed',
                              'form': form})