Ejemplo n.º 1
0
def change_password (new_pass, old_pass):
    enc_novo = Encriptador (new_pass)
    enc_velho = Encriptador (old_pass)
    # testa se a senha informada esta correta
    f = open (CHECK_FILE, 'r')
    check = f.read()
    f.close()
    if enc_velho.decripta ( check ) != CHECK_STR:
        return False
        # se nao tiver cai fora

    cols = Collection.select()
    for c in cols:
        nome = enc_velho.decripta (c.nome)
        c.nome = enc_novo.encripta (nome)
        print "migrando colection ", nome
        c.save()
        
    sens = Senha.select()
    for s in sens:
        desc = enc_velho.decripta (s.desc)
        valor = enc_velho.decripta (s.valor)
        s.desc = enc_novo.encripta (desc)
        s.valor = enc_novo.encripta (valor)
        print "migrando senha ", desc
        s.save()
        
    f = open (CHECK_FILE, 'w')
    f.write ( enc_novo.encripta (CHECK_STR) )
    f.close()
Ejemplo n.º 2
0
def migra (e):
    from models.senhas import Senha, Collection
    cols = Collection.select()
    for c in cols:
        nome = e.decripta (c.nome)
        c.nome = e.encripta (nome)
        print "migrando colection ", nome
        c.save()
        
    sens = Senha.select()
    for s in sens:
        desc = e.decripta (s.desc)
        valor = e.decripta (s.valor)
        s.desc = e.encripta (desc)
        s.valor = e.encripta (valor)
        print "migrando senha ", desc
        s.save()
    
    f = open (CHECK_FILE, 'w')
    f.write ( e.encripta (CHECK_STR) )
    f.close()
Ejemplo n.º 3
0
 def recarrega (self):
     self.ids.area_collects.clear_widgets()
     cols = Collection.select()
     for c in cols:
         b = ItemColecao (c, smanager=self.smanager)
         self.ids.area_collects.add_widget(b)