def post(self): hashedPassword = jt.service.hash.hashPassword( self.request.get('password')) query = db.GqlQuery( "SELECT * FROM Account WHERE username = :1 AND password = :2 AND uuid = :3", self.request.get('username'), hashedPassword, self.request.get('uuid')) account = query.get() if account == None: count = db.GqlQuery( "SELECT __key__ FROM Account WHERE username = :1 AND password = :2", self.request.get('username'), hashedPassword).count(1) if count == 1: accountKey = 'WrongPhone' else: accountKey = 'NotFound' else: token = jt.auth.generateLoginToken() account.loginToken = token account.lastLogin = datetime.datetime.utcnow() account.put() jt.auth.setCookie(self, token) accountKey = account.key() self.response.out.write('{"accountKey":"%s"}' % accountKey)
def get(self): if not jt.auth.auth(self): jt.auth.denied(self) return account = db.get(jt.auth.accountKey(self)) account.loginToken = jt.auth.generateLoginToken() #store new login token, don't tell anybody what it is account.put() self.response.out.write('{ "response":"Done"} ')
def get(self): if not jt.auth.auth(self): jt.auth.denied(self) return account = db.get(jt.auth.accountKey(self)) account.loginToken = jt.auth.generateLoginToken( ) #store new login token, don't tell anybody what it is account.put() self.response.out.write('{ "response":"Done"} ')
def post(self): hashedPassword = jt.service.hash.hashPassword(self.request.get('password')) query = db.GqlQuery("SELECT * FROM Account WHERE username = :1 AND password = :2 AND uuid = :3",self.request.get('username'), hashedPassword, self.request.get('uuid')) account = query.get() if account == None: count = db.GqlQuery("SELECT __key__ FROM Account WHERE username = :1 AND password = :2",self.request.get('username'), hashedPassword ).count(1) if count == 1: accountKey = 'WrongPhone' else: accountKey = 'NotFound' else: token = jt.auth.generateLoginToken() account.loginToken = token account.lastLogin = datetime.datetime.utcnow() account.put() jt.auth.setCookie(self, token) accountKey = account.key() self.response.out.write('{"accountKey":"%s"}' % accountKey )