Начальное наполнение

This commit is contained in:
parent 30ac2b2590
commit 290247fc1e
6 changed files with 58 additions and 0 deletions

2
__init__.py Normal file
View File

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import controllers

13
__manifest__.py Normal file
View File

@ -0,0 +1,13 @@
{
'name': "Password Policy support for Signup",
'depends': ['auth_password_policy', 'portal'],
'category': 'Tools',
'auto_install': True,
'data': ['views/templates.xml'],
'assets': {
'web.assets_frontend': [
'auth_password_policy_portal/static/**/*',
],
},
'license': 'LGPL-3',
}

10
controllers.py Normal file
View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
from odoo.http import request
from odoo.addons.portal.controllers.portal import CustomerPortal
class CustomerPortalPasswordPolicy(CustomerPortal):
def _prepare_portal_layout_values(self):
d = super()._prepare_portal_layout_values()
d['password_minimum_length'] = request.env['ir.config_parameter'].sudo().get_param('auth_password_policy.minlength')
return d

View File

@ -0,0 +1,15 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-26 21:55+0000\n"
"PO-Revision-Date: 2023-10-26 21:55+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

View File

@ -0,0 +1,6 @@
.o_portal_security_body #new-password-group {
position: relative;
meter {
bottom: calc(#{$input-height-sm} / 2 - 7px);
}
}

12
views/templates.xml Normal file
View File

@ -0,0 +1,12 @@
<odoo>
<template id="portal_my_security" inherit_id="portal.portal_my_security"
name="Password policy data for portal">
<xpath expr="//div[input[@name='new1']]" position="attributes">
<attribute name="id">new-password-group</attribute>
</xpath>
<!-- only put meter on first "new password" field since both must be identical -->
<xpath expr="//input[@name='new1']" position="after">
<owl-component name="password_meter" props='{"selector": "input[name=new1]"}'/>
</xpath>
</template>
</odoo>