Example #1
0
  def test_signup(self):
    fix = LimitedBetaCandidateData.acmeceo_uninvited
    response = self.post('/betasignup/', {'email': fix.email, 'tech': fix.tech})
    assert 'Thanks a lot!' in str(response)

    cc = LimitedBetaCandidate.all().fetch(100)
    assert len(cc) == 1
    assert cc[0].email == fix.email
    assert cc[0].tech == fix.tech
Example #2
0
  def post(self):
    email = self.request.get('email')
    tech  = self.request.get('tech')
    if tech == None:
      tech = ''
    candidate = LimitedBetaCandidate(email=email, tech=tech)
    candidate.put()
    
    body = """
Hey buddies,

CrashKit limited beta program signup:

His/her e-mail address:  %(email)s
He/she is interested in: %(tech)s

Please visit http://%(host)s/admin/beta/ to invite this user.
""" % dict(email=candidate.email, host=self.request.host, tech=candidate.tech)
    mail.send_mail_to_admins('*****@*****.**', '[CrK] New Limited Beta User', body)
    
    self.response.out.write("Thanks a lot! We'll e-mail you an invitation code soon.")
Example #3
0
  def get(self, invitation_code):
    self.invitation_code = invitation_code
    self.tabid = 'account-settings-tab'
    if not users.is_current_user_admin():
      if invitation_code == None or len(invitation_code.strip()) == 0:
        self.render_and_finish('account_signup_nocode.html')
      candidate = LimitedBetaCandidate.all().filter('invitation_code', invitation_code).get()
      if candidate == None:
        self.render_and_finish('account_signup_badcode.html')
    if not self.user:
      self.render_and_finish('account_signup_googlenotice.html')

    self.account_form = AccountForm()
    self.render_screen_and_finish()
Example #4
0
  def get(self):
    self.server_config = server_config()
    if self.server_config.signup_email_text is None or len(self.server_config.signup_email_text) == 0:
      self.redirect_and_finish('/admin/beta/', flash = "Please set up a email text before accepting people.")
      
    key = self.request.get('key')
    candidate = LimitedBetaCandidate.get(key)
    candidate.invitation_code = random_string()
    candidate.put()
    
    data = dict(email=candidate.email, host=self.request.host, code=candidate.invitation_code)
    body = self.server_config.signup_email_text % data
    subject = self.server_config.signup_email_subject % data

    mail.send_mail('*****@*****.**', candidate.email, subject, body)
    
    self.redirect_and_finish('/admin/beta/', flash = "Accepted %s, his invite code is %s." % (candidate.email, candidate.invitation_code))
Example #5
0
 def post(self, invitation_code):
   if not users.is_current_user_admin():
     candidate = LimitedBetaCandidate.all().filter('invitation_code', invitation_code).get()
     if candidate == None:
       self.redirect_and_finish('/signup/%s' % invitation_code)
       
   self.account_form = AccountForm(self.request.POST)
   if self.account_form.validate():
     existing_account = Account.all().filter('permalink', self.account.permalink).get()
     if existing_account:
       self.account_form.permalink.errors.append("This name is already taken.")
     else:
       self.account_form.populate_obj(self.account)
       self.account.put()
       if not self.person.is_saved():
         self.person.put()
       self.account_access = AccountAccess(key_name=AccountAccess.key_for(self.person.key(), self.account.key()).name(),
           person=self.person, account=self.account, admin=True)
       self.account_access.put()
       self.redirect_and_finish(u'/%s/products/new/' % self.account.permalink,
         flash = u"Your account has been created. You can add your first product now.")
     
   self.render_screen_and_finish()
Example #6
0
 def render_editor_and_finish(self):
   self.candidates = LimitedBetaCandidate.all().filter('invitation_code', None).filter('rejected', False).order('created_at').fetch(100)
   self.render_and_finish('beta_candidates.html')
Example #7
0
 def get(self):
   key = self.request.get('key')
   candidate = LimitedBetaCandidate.get(key)
   candidate.rejected = True
   candidate.put()
   self.redirect_and_finish('/admin/beta/', flash = "Rejected %s." % candidate.email)