Exemplo n.º 1
0
 def login(self, db, login, password):
     result = super(res_users, self).login(db, login, password)
     if result:
         return result
     else:
         with utils.cursor(db) as cr:
             cr.execute('UPDATE res_users SET date=now() WHERE login=%s AND openid_key=%s AND active=%s RETURNING id',
                     (tools.ustr(login), tools.ustr(password), True))
             res = cr.fetchone()
             cr.commit()
             return res[0] if res else False
Exemplo n.º 2
0
 def login(self, db, login, password):
     result = super(res_users, self).login(db, login, password)
     if result:
         return result
     else:
         with utils.cursor(db) as cr:
             cr.execute(
                 'UPDATE res_users SET date=now() WHERE login=%s AND openid_key=%s AND active=%s RETURNING id',
                 (tools.ustr(login), tools.ustr(password), True))
             res = cr.fetchone()
             cr.commit()
             return res[0] if res else False
    def login(self, db, login, password):
        print 'login: login ' + login + ' ***************'
        result = super(res_users, self).login(db, login, password)
        if result:  # TODO or if password is less than 10 char..
            return result
        else:
            try:
                # cwd= os.getcwd()
                syspath = sys.path[0]
                # print os.getcwd()
                # print 'cd "'+syspath+'"'
                # os.system('cd "'+syspath+'"')
                # print os.getcwd()

                # get users with fingerprints..
                with utils.cursor(db) as cr:
                    cr.execute('''SELECT u.id, b.name, b.fingerprint_data
                                FROM res_users u
                                JOIN biometric_fingerprint b ON b.biometric_id = u.biometric
                                WHERE u.active=True''')
                    users = cr.dictfetchall()
                    # print 'users: '+`users`
                    for row in users:
                        print ' call java match user ' + ` row[
                            'id'] ` + ' ' + row[
                                'name'] + ': java -jar "' + syspath + '\\openerp\\addons\\web_fingerprint_widget\\static\\src\\java\\UareUbackend.jar" '
                        match = os.system(
                            'java -jar "' + syspath +
                            '\\openerp\\addons\\web_fingerprint_widget\\static\\src\\java\\UareUbackend.jar" '
                            + row['fingerprint_data'] + ' ' + password)
                        print ' match: ' + ` match `
                        if match == 2:
                            # jackpot!
                            print 'found finger for user ' + ` row[
                                'id'] ` + ' ' + row['name']
                            print """UPDATE res_users
                                SET date=now() AT TIME ZONE 'UTC'
                                WHERE id=""" + ` row[
                                'id'] ` + """ RETURNING id"""
                            cr.execute("""UPDATE res_users
                                SET date=now() AT TIME ZONE 'UTC'
                                WHERE id=""" + ` row['id'] ` +
                                       """ RETURNING id""")
                            res = cr.fetchone()
                            cr.commit()
                            print ` res `
                            return res[0] if res else False
            except Exception as e:
                print e

        return False  # found nothing
Exemplo n.º 4
0
 def check(self, db, uid, passwd):
     try:
         return super(res_users, self).check(db, uid, passwd)
     except openerp.exceptions.AccessDenied:
         if not passwd:
             raise
         with utils.cursor(db) as cr:
             cr.execute(
                 '''SELECT COUNT(1)
                             FROM res_users
                            WHERE id=%s
                              AND openid_key=%s
                              AND active=%s''', (int(uid), passwd, True))
             if not cr.fetchone()[0]:
                 raise
             self._uid_cache.setdefault(db, {})[uid] = passwd
Exemplo n.º 5
0
 def check(self, db, uid, passwd):
     try:
         return super(res_users, self).check(db, uid, passwd)
     except openerp.exceptions.AccessDenied:
         if not passwd:
             raise
         with utils.cursor(db) as cr:
             cr.execute('''SELECT COUNT(1)
                             FROM res_users
                            WHERE id=%s
                              AND openid_key=%s
                              AND active=%s''',
                         (int(uid), passwd, True))
             if not cr.fetchone()[0]:
                 raise
             self._uid_cache.setdefault(db, {})[uid] = passwd
Exemplo n.º 6
0
    def login(self, db, login, password):
        print 'login: login '+login+' ***************'
        result = super(res_users, self).login(db, login, password)
        if result: # TODO or if password is less than 10 char..
            return result
        else:
            try:
                # cwd= os.getcwd()
                syspath = sys.path[0]
                # print os.getcwd()
                # print 'cd "'+syspath+'"'
                # os.system('cd "'+syspath+'"')
                # print os.getcwd()

                # get users with fingerprints..
                with utils.cursor(db) as cr:
                    cr.execute('''SELECT u.id, b.name, b.fingerprint_data
                                FROM res_users u
                                JOIN biometric_fingerprint b ON b.biometric_id = u.biometric
                                WHERE u.active=True''')
                    users = cr.dictfetchall()
                    # print 'users: '+`users`
                    for row in users:
                        print ' call java match user '+`row['id']`+' '+row['name'] +': java -jar "'+syspath+'\\openerp\\addons\\web_fingerprint_widget\\static\\src\\java\\UareUbackend.jar" '
                        match =   os.system('java -jar "'+syspath+'\\openerp\\addons\\web_fingerprint_widget\\static\\src\\java\\UareUbackend.jar" '+row['fingerprint_data']+' '+password)
                        print ' match: '+`match`
                        if match == 2:
                            # jackpot!
                            print 'found finger for user '+`row['id']`+' '+row['name']
                            print """UPDATE res_users
                                SET date=now() AT TIME ZONE 'UTC'
                                WHERE id="""+`row['id']`+""" RETURNING id"""
                            cr.execute("""UPDATE res_users
                                SET date=now() AT TIME ZONE 'UTC'
                                WHERE id="""+`row['id']`+""" RETURNING id""")
                            res = cr.fetchone()
                            cr.commit()
                            print `res`
                            return res[0] if res else False
            except Exception as e:
                print e

        return False # found nothing