Community mailing list archives

community@mail.odoo.com

Re: Password policy

by
André Pereira
- 02/20/2015 05:20:23
I'd say you need to override the _set_new_password method in res.users, so that it validates before storing it.

Example:

from string import digits, uppercase, lowercase

class res_users(osv.osv):
    _inherit = 'res.users'
   
    def _set_new_password(self, cr, uid, id, name, value, args, context=None):
        password = value
        try:
            assert len(password) >= 8, "Password must have at least 8 chars"
            assert any(char in digits for char in password), "Password must contain at least one number"
            assert (any(char in uppercase for char in password) and any(char in lowercase for char in password), "Password must have at least one lowercase and one uppercase characters"
       except AssertionError as e:
            raise osv.except_osv('Validation Error', e.message)
       return super(res_users, self)._set_new_password(cr, uid, id, name, value, args, context=context)

2015-02-19 19:13 GMT+00:00 Gastón Pablo Pérez <gpperez@gmail.com>:
I need to define rules for user passwords, what would be the way for example if I want to define a rule in which a pass must be at least 8 chars


Lic. Gastón Pablo Perez
Email: gpperez@gmail.com

2015-02-19 15:57 GMT-03:00 kwaye kant <gabrielkwaye@gmail.com>:

I doubt and I think you have to set the rules directly in the module. Or you have a module that implements the Auth registration with those policies.

On Feb 19, 2015 7:37 PM, "Gastón Pablo Pérez" <gpperez@gmail.com> wrote:

Hi:

Is there a module for odoo v8 that permits me to define some password policies?

for example:

- at least 8 characters
- letters and numbers

Lic. Gastón Pablo Perez
Email: gpperez@gmail.com

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
Cumprimentos,


André Paramés

Developer

Miraflores Office Center,

Avenida das Túlipas, nº 6,

13ºA/B 1495-161 Algés

e. app@thinkopensolutions.pt

m. +351 960 029 663

t. +351 214 123 492

f. +351 214 123 493

O conteúdo desta mensagem de correio electrónico e seus anexos é confidencial e de uso reservado. Se não é o destinatário apague-a e informe o remetente. Esta mensagem é verificada pelo nosso sistema de anti-vírus, ainda assim não aceitamos qualquer responsabilidade por danos causados por vírus que possam estar contidos nesta mensagem. Para mais informações visite-nos em www.thinkopensolutions.com.

 Não imprima este email caso não seja estritamente necessário. A Terra agradece-lhe!