Community mailing list archives

community@mail.odoo.com

Re: Migrate encrypted user passwords from v6 to v9

by
Holger Brunn
- 11/07/2016 17:42:25
> What is the proper way to migrate passwords from v6 to v9 ?

https://github.com/odoo/odoo/blob/6.0/addons/base_crypt/crypt.py#L72 looks a 
lot like it generates hashes that passlib used in https://github.com/OCA/OCB/
blob/9.0/addons/auth_crypt/auth_crypt.py#L62 might just understand. Did you 
ever try to simply move the password column to password_crypt? This might just 
work. I even think I remember to have done exactly that: https://github.com/
OCA/OpenUpgrade/blob/7.0/addons/auth_crypt/migrations/7.0.1.1/pre-
migration.py#L31

[The rest is quite academic, because the above is your solution. But given I 
wrote this text already, I won't delete it] If not, you'll have to take the 
hash apart (separate magic and salt from the hash, split by the dollar sign) 
and craft one passlib understands. If this is not possible (which I doubt), 
you'd have to keep the old hashes in some separate column, and for every login 
check if there exists an old hash, verify it with the v6 code, and write a new 
hash v9 style. Don't forget to clear out the old hash column then.
But still, my guess would be that renaming the column suffices.

-- 
Therp - Maatwerk in open ontwikkeling

Holger Brunn - Ontwerp en implementatie

mail: holger@therp.nl
web: http://therp.nl