Exemplo n.º 1
0
def updateUserData(username, pwd, email, dhome, mhome, tts=False, 
                  lang="it",slide=False, webspeech='touch', speechlang='it-IT', 
                  theme='dmblack',leftb='hidden-sm', rightb='hidden-sm'):
   def onRes(res):
      if res>0:
         return defer.succeed(username+" correctly updated")
      else:
         return defer.fail("User not found")
   password=genutils.hashPwd(pwd)
   qstring="""
      UPDATE users SET email='%s',desktop_homepath='%s',mobile_homepath='%s',last_update='%s',language='%s'""" %(email,dhome,mhome,str(time.time()),lang)
   if password:
      qstring+=",passwd='%s'" %(password)
   if tts:
      qstring+=",tts=1"
   else:
      qstring+=",tts=0"
   if slide:
      qstring+=",slide=1"
   else:
      qstring+=",slide=0"
   qstring+=",webspeech='%s'" % webspeech
   qstring+=",speechlang='%s'" % speechlang
   qstring+=",gui_theme='%s'" % str(theme)
   qstring+=",left_bar='%s'" % str(leftb)
   qstring+=",right_bar='%s'" % str(rightb)
   qstring+=" WHERE username='******' AND active > 0" %(username)
   log.debug(qstring)
   return runOperation(qstring).addCallback(onRes)
Exemplo n.º 2
0
 def checkAuth(self, usr, pwd):
    log.debug("CheckAuth for "+str(usr)+" "+str(pwd))
    return self.core.getAuth(usr, genutils.hashPwd(pwd))