Browse Source

Completa migração de senhas do zope

pull/1728/head
Marcio Mazza 7 years ago
parent
commit
e9f7884f68
  1. 2
      sapl/hashers.py
  2. 2
      sapl/legacy/migracao_usuarios.py

2
sapl/hashers.py

@ -44,6 +44,8 @@ ZOPE_SHA1_PREFIX = '{SSHA}'
def zope_encoded_password_to_django(encoded):
"Migra um hash de senha do zope para uso com o ZopeSHA1PasswordHasher"
if encoded.startswith(ZOPE_SHA1_PREFIX):
data = encoded[len(ZOPE_SHA1_PREFIX):]
salt = get_salt_from_zope_sha1(data)

2
sapl/legacy/migracao_usuarios.py

@ -1,6 +1,7 @@
import yaml
from django.contrib.auth.models import Group, User
from sapl.hashers import zope_encoded_password_to_django
from sapl.settings import MEDIA_ROOT
PERFIL_LEGADO_PARA_NOVO = {legado: Group.objects.get(name=novo)
@ -83,6 +84,7 @@ def migra_usuarios():
for nome, senha, perfis in usuarios:
usuario = User.objects.get_or_create(username=nome)[0]
usuario.password = zope_encoded_password_to_django(senha)
for perfil in perfis:
if perfil in ADMINISTRADORES:
# Manager

Loading…
Cancel
Save