Пример #1
0
 def update_img(self, req_data, error=None):
     if error or not req_data:
         return
     vcode_path = os.path.join(Config.get_tmp_path(self.form['username']),
                               'bcloud-signin-vcode')
     with open(vcode_path, 'wb') as fh:
         fh.write(req_data)
     self.vcode_img.set_from_file(vcode_path)
Пример #2
0
 def update_img(self, req_data, error=None):
     if error or not req_data:
         return
     vcode_path = os.path.join(Config.get_tmp_path(self.form['username']),
                               'bcloud-signin-vcode')
     with open(vcode_path, 'wb') as fh:
         fh.write(req_data)
     self.vcode_img.set_from_file(vcode_path)
Пример #3
0
 def load_auth(self, username):
     auth_file = os.path.join(Config.get_tmp_path(username), 'auth.json')
     if os.path.exists(auth_file):
         if time.time() - os.stat(auth_file).st_mtime < DELTA:
             with open(auth_file) as fh:
                 c, tokens = json.load(fh)
             cookie = RequestCookie(c)
             return cookie, tokens
     return None, None
Пример #4
0
 def load_auth(self, username):
     auth_file = os.path.join(Config.get_tmp_path(username), 'auth.json')
     if os.path.exists(auth_file):
         if time.time() - os.stat(auth_file).st_mtime < DELTA:
             with open(auth_file) as fh:
                 c, tokens = json.load(fh)
             cookie = RequestCookie(c)
             return cookie, tokens
     return None, None
Пример #5
0
 def update_img(self, request, error=None):
     if error or not request:
         # TODO: add a refresh button
         return
     vcode_path = os.path.join(
             Config.get_tmp_path(self.app.profile['username']),
             'bcloud-download-vcode.jpg')
     with open(vcode_path, 'wb') as fh:
         fh.write(request.data)
     self.img.set_from_file(vcode_path)
Пример #6
0
 def update_img(self, request, error=None):
     if error or not request:
         # TODO: add a refresh button
         return
     vcode_path = os.path.join(
         Config.get_tmp_path(self.app.profile['username']),
         'bcloud-download-vcode.jpg')
     with open(vcode_path, 'wb') as fh:
         fh.write(request.data)
     self.img.set_from_file(vcode_path)
Пример #7
0
 def update_img(self, req_data, error=None):
     if error or not req_data:
         self.refresh_vcode()
         logger.error("SigninDialog.update_img: %s, %s" % (req_data, error))
         return
     vcode_path = os.path.join(Config.get_tmp_path(self.username), "bcloud-signin-vcode.jpg")
     with open(vcode_path, "wb") as fh:
         fh.write(req_data)
     self.vcode_img.set_from_file(vcode_path)
     self.loading_spin.stop()
     self.loading_spin.hide()
     self.vcode_entry.set_sensitive(True)
Пример #8
0
 def update_img(self, req_data, error=None):
     if error or not req_data:
         self.refresh_vcode()
         logger.error('SigninDialog.update_img: %s, %s' % (req_data, error))
         return
     vcode_path = os.path.join(Config.get_tmp_path(self.username),
                               'bcloud-signin-vcode.jpg')
     with open(vcode_path, 'wb') as fh:
         fh.write(req_data)
     self.vcode_img.set_from_file(vcode_path)
     self.loading_spin.stop()
     self.loading_spin.hide()
     self.vcode_entry.set_sensitive(True)
Пример #9
0
 def dump_auth(self, username, cookie, tokens):
     auth_file = os.path.join(Config.get_tmp_path(username), 'auth.json')
     with open(auth_file, 'w') as fh:
         json.dump([str(cookie), tokens], fh)
Пример #10
0
 def dump_auth(self, username, cookie, tokens):
     auth_file = os.path.join(Config.get_tmp_path(username), 'auth.json')
     with open(auth_file, 'w') as fh:
         json.dump([str(cookie), tokens], fh)