mirror of
https://github.com/bringout/oca-server-auth.git
synced 2026-04-19 00:32:00 +02:00
Initial commit: OCA Server Auth packages (29 packages)
This commit is contained in:
commit
3ed80311c4
1325 changed files with 127292 additions and 0 deletions
|
|
@ -0,0 +1,24 @@
|
|||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
import logging
|
||||
|
||||
from odoo import SUPERUSER_ID, api
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
if not version:
|
||||
return
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.info(
|
||||
"Password Security: migration of the password_length "
|
||||
"value into standard minlength field."
|
||||
)
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
if env["res.company"]._fields.get("password_length"):
|
||||
password_length_list = env["res.company"].search([]).mapped("password_length")
|
||||
ICP = env["ir.config_parameter"]
|
||||
minlength = ICP.get_param("auth_password_policy.minlength")
|
||||
minlength = int(minlength) if minlength else 0
|
||||
ICP.set_param(
|
||||
"auth_password_policy.minlength", max(minlength, *password_length_list)
|
||||
)
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
def migrate(cr, version):
|
||||
# Set password date for already existing users
|
||||
cr.execute(
|
||||
"""
|
||||
UPDATE
|
||||
res_users
|
||||
SET
|
||||
password_write_date = NOW() at time zone 'UTC'
|
||||
WHERE
|
||||
password_write_date IS NULL;
|
||||
"""
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue