Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Intelligence artificielle
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Supermarché
    • Quincaillerie
    • Magasin de jouets
    Restauration & Hôtellerie
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brasserie
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Commerce
    • Homme à tout faire
    • Matériel informatique & support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Parcourir toutes les industriesInauguration Odoo Lyon
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenir partenaire
    • Services pour partenaires
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

Migrate database, password with CryptContext

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
usersmigrationdjangoodoo16featurescryptography
1 Répondre
2394 Vues
Avatar
JRF hydraulique, Nomazy

We are migrating from Django to Odoo 16

I have migrated with sql the table auth_users from Django to res_users in Odoo 16. Then I added in a extra addon :class Users(models.Model):
_inherit = "res.users"

@tools.ormcache()
def _crypt_context(self):
"""
add 'django_pbkdf2_sha256', 'django_salted_sha1' for old user migrated from django
"""
cfg = self.env['ir.config_parameter'].sudo()
return CryptContext(
# kdf which can be verified by the context. The default encryption
# kdf is the first of the list
['pbkdf2_sha512', 'django_pbkdf2_sha256', 'django_salted_sha1'],
# deprecated algorithms are still verified as usual, but
# ``needs_update`` will indicate that the stored hash should be
# replaced by a more recent algorithm.
deprecated=['auto'],
pbkdf2_sha512__rounds=max(MIN_ROUNDS, int(cfg.get_param('password.hashing.rounds', 0))),
)

Then I can loggin in odoo 16 with an old credential from Dango. And I see in the res_user that CryptContext had moved the password from a django_pbkdf2_sha256 scheme to a new one with pbkdf2_sha512 scheme.
GREAT ! but ...
When I upgrade any addon with _inherit = "res.users", Odoo move all password with old scheme to new one = the first in scheme option of _crypt_context, but WITHOUT taking account the other scheme in this _crypt_context.
INFO ... odoo.modules.registry:  a module (with inherit res_user): creating or updating database tables ...

take 3 hours  for 20 000 users

and move all password with old scheme to new one as the old scheme was 'plaintext'. I have checked this _crypt_context.verify(old_password_from_django, new password odoo) = True. So, of course users have lost their original password.

In addition, If I change the first scheme to 'sha256_crypt' for exemple, the upload of such module, move only the password of django scheme in sha256_crypt not the one with pbkdf2_sha512. Why ? I suppose pbkdf2_sha512 is newest than sha256_crypt ?

I'would appreciate a lot any idea to avoid me to ask for 20 000 loggin before uploading module.



0
Avatar
Ignorer
Avatar
JRF hydraulique, Nomazy
Auteur Meilleure réponse

I found the guilty one : def init in class Users which "automatically encrypted at startup: look for passwords which don't
# match the "extended" MCF and pass those through passlib."

So, a Django hash password not beginning with a $ is moved to pbkdf2_sha512 as plain_text, after any upload of module.

Very bad idea, worst than a bug. To fix it inherit init with only a pass


0
Avatar
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
Field used in context is restricted to certain groups Résolu
migration odoo16features
Avatar
Avatar
Avatar
3
juin 24
5334
odoo 15 to odoo 16 Migration using openupgrade Résolu
migration odoo16features
Avatar
Avatar
1
janv. 23
17679
psycopg2.errors.NumericValueOutOfRange
migration psycopg2.errors odoo16features
Avatar
Avatar
1
avr. 24
5758
Problems migrating from odoo 13 to 16
javascript migration odoo16features
Avatar
0
nov. 23
2631
Cannot access user menu
users odoo odoo16features
Avatar
Avatar
1
juil. 23
3468
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenir partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk Slovenščina Español (América Latina) Español Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now