Esempio n. 1
0
 def add_or_update_domain():
     domain = Domain.get_or_insert(
         util.domain_from_link(
             util.replace_test_domains_with_localhost(
                 auth_entity.key.id())))
     domain.auth = auth_entity.key
     if state not in domain.tokens:
         domain.tokens.append(state)
     domain.put()
     flash(f'Authorized you for {domain.key.id()}.')
Esempio n. 2
0
  def finish(self, auth_entity, state=None):
    if not auth_entity:
      return

    assert state
    domain = Domain.get_or_insert(util.domain_from_link(auth_entity.key.id()))
    domain.auth = auth_entity.key
    if state not in domain.tokens:
      domain.tokens.append(state)
    domain.put()

    self.messages.add(f'Authorized you for {domain.key.id()}.')
    self.redirect('/')