Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11] Password expiration cannot be disabled #100

Closed
javiermatos opened this issue May 20, 2019 · 3 comments
Closed

[11] Password expiration cannot be disabled #100

javiermatos opened this issue May 20, 2019 · 3 comments

Comments

@javiermatos
Copy link

I have noticed password_security/models/res_users.py is different for versions 11 and 12 regarding the _password_has_expired function: in version 12, there is a condition that allows to disable password expiration just by setting password_expiration = 0 (which makes sense),

    @api.multi
    def _password_has_expired(self):
        self.ensure_one()
        if not self.password_write_date:
            return True

        if not self.company_id.password_expiration:
            return False

        days = (fields.Datetime.now() - self.password_write_date).days
        return days > self.company_id.password_expiration

while in version 11, the function does not accept a value just to disable it.

    @api.multi
    def _password_has_expired(self):
        self.ensure_one()
        if not self.password_write_date:
            return True
        write_date = fields.Datetime.from_string(self.password_write_date)
        today = fields.Datetime.from_string(fields.Datetime.now())
        days = (today - write_date).days
        return days > self.company_id.password_expiration

Can we "backport" that feature or is there any reason not to implement it that way in version 11? Will you accept a pull request of that feature to be merged in 11.0 branch?

@pedrobaeza
Copy link
Member

Please do the proper PR with the backport.

@javiermatos
Copy link
Author

Hola Pedro, I think the PR is done and ready to merge. Please, tell me in case there is something else I have to fix/improve for having this ready.

@pedrobaeza
Copy link
Member

OK, closing this one as there's a PR. Have you signed CLA?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants