[enh] Manual migration if not weak password

This commit is contained in:
ljf 2018-10-25 14:56:12 +02:00
parent 2d5077e2ea
commit 7975d73cad
2 changed files with 17 additions and 4 deletions

View file

@ -287,6 +287,7 @@
"migration_0005_postgresql_94_not_installed": "Postgresql was not installed on your system. Nothing to do!",
"migration_0005_postgresql_96_not_installed": "Postgresql 9.4 has been found to be installed, but not postgresql 9.6 !? Something weird might have happened on your system :( ...",
"migration_0005_not_enough_space": "Not enough space is available in {path} to run the migration right now :(.",
"migration_0006_root_admin_sync_warning": "Yunohost now expect admin and root passwords to be synchronized. By running this migration, your root password is going to be replaced by your root password.",
"migrations_backward": "Migrating backward.",
"migrations_bad_value_for_target": "Invalid number for target argument, available migrations numbers are 0 or {}",
"migrations_cant_reach_migration_file": "Can't access migrations files at path %s",

View file

@ -21,14 +21,26 @@ class MyMigration(Migration):
def migrate(self):
if self._is_root_pwd_listed(SMALL_PWD_LIST):
new_hash = self._get_admin_hash()
self._replace_root_hash(new_hash)
new_hash = self._get_admin_hash()
self._replace_root_hash(new_hash)
def backward(self):
pass
@property
def mode(self):
if self._is_root_pwd_listed(SMALL_PWD_LIST):
return "auto"
return "manual"
@property
def disclaimer(self):
if self._is_root_pwd_listed(SMALL_PWD_LIST):
return None
return m18n.n("migration_0006_root_admin_sync_warning")
def _get_admin_hash(self):
"""
Ask for admin hash the ldap db