Ejemplo n.º 1
0
  def post(self):
    email = self.request.get('inputEmail')
    password = self.request.get('inputPassword')

    credential, credential_dirty = get_or_create_credential()
    logger.info('Credential: %s', credential)
    if credential.email != email:
      logger.info('Updating email address')
      credential.cookie = None
      credential.email = email
      credential_dirty = True

    if credential.password != password:
      logger.info('Updating password')
      credential.cookie = None
      credential.password = password
      credential_dirty = True

    if credential_dirty:
      logger.info('Saving')
      credential.put()

    devices, login_failed = load_devices(credential)

    template = JINJA_ENVIRONMENT.get_template('devices.html')
    self.response.write(template.render(devices=devices, login_failed=login_failed,
                                        credential=credential))
Ejemplo n.º 2
0
    def post(self):
        email = self.request.get('inputEmail')
        password = self.request.get('inputPassword')

        credential, credential_dirty = get_or_create_credential()
        logger.info('Credential: %s', credential)
        if credential.email != email:
            logger.info('Updating email address')
            credential.cookie = None
            credential.email = email
            credential_dirty = True

        if credential.password != password:
            logger.info('Updating password')
            credential.cookie = None
            credential.password = password
            credential_dirty = True

        if credential_dirty:
            logger.info('Saving')
            credential.put()

        devices, login_failed = load_devices(credential)

        template = JINJA_ENVIRONMENT.get_template('devices.html')
        self.response.write(
            template.render(devices=devices,
                            login_failed=login_failed,
                            credential=credential))
Ejemplo n.º 3
0
  def get(self):
    login_failed = False
    devices = {}

    credential, new_credential = get_or_create_credential()

    logger.info('credential %s', credential)
    if not new_credential:
      devices, login_failed = load_devices(credential)

    template = JINJA_ENVIRONMENT.get_template('index.html')
    self.response.write(template.render(credential=credential, devices=devices,
                                        login_failed=login_failed))
Ejemplo n.º 4
0
    def get(self):
        login_failed = False
        devices = {}

        credential, new_credential = get_or_create_credential()

        logger.info('credential %s', credential)
        if not new_credential:
            devices, login_failed = load_devices(credential)

        template = JINJA_ENVIRONMENT.get_template('index.html')
        self.response.write(
            template.render(credential=credential,
                            devices=devices,
                            login_failed=login_failed))
Ejemplo n.º 5
0
  def post(self):
    deviceid = self.request.get('deviceid')

    credential, credential_dirty = get_or_create_credential()

    if credential.deviceid != deviceid:
      logger.info('Updating device')
      credential.deviceid = deviceid
      credential_dirty = True

    if credential_dirty:
      logger.info('Saving')
      credential.put()

    template = JINJA_ENVIRONMENT.get_template('testdevice.html')
    self.response.write(template.render(credential=credential))
Ejemplo n.º 6
0
    def post(self):
        deviceid = self.request.get('deviceid')

        credential, credential_dirty = get_or_create_credential()

        if credential.deviceid != deviceid:
            logger.info('Updating device')
            credential.deviceid = deviceid
            credential_dirty = True

        if credential_dirty:
            logger.info('Saving')
            credential.put()

        template = JINJA_ENVIRONMENT.get_template('testdevice.html')
        self.response.write(template.render(credential=credential))
Ejemplo n.º 7
0
 def post(self):
   credential, _ = get_or_create_credential()
   send_notification(credential, 'test')
   self.response.write('Notification sent.')
Ejemplo n.º 8
0
 def post(self):
     credential, _ = get_or_create_credential()
     send_notification(credential, 'test')
     self.response.write('Notification sent.')