[18.0][MIG] auth_brute_force: Migration to 18.0#870
[18.0][MIG] auth_brute_force: Migration to 18.0#870hitesh-erpharbor wants to merge 26 commits intoOCA:18.0from
Conversation
To fix OCA/server-tools#1125 I needed to refactor the addon. To whitelist IPs now you use a config parameter, which renders res.banned.remote model unneeded. The fix is affected by odoo/odoo#24183 and will not work until it gets fixed upstream due to the technical limitations implied.
- The `whitelisted` field needs to exist in view to be usable. - The correct class is `decoration-danger` for tree views.
…#1251) Include HACK for odoo/odoo#24833, which explains the false positive problem we were having here: an addon being importable doesn't mean it is installed.
- Remove Python coding headers. - Remove v10 migration scripts. - Standard py2-py3 changes. - Do not encode POST data in tests, Odoo now uses `requests` for `HttpCase` connections.
…s#1258) In Odoo v9, every request calls `res.users.check()`, which stores one authentication attempt per request, which is false. Besides, it easily leads to hitting ip-api.com rate limits, so now that API is only asked when seeing in form view (simply by setting the computed field as not stored). Also, form view was hidden, so it's now visible.
By implementing nestable savepoints in the TestCursor (courtesy of Holger Brunn), the failed login attempts are preserved during the test.
Currently translated at 62.5% (15 of 24 strings) Translation: server-auth-11.0/server-auth-11.0-auth_brute_force Translate-URL: https://translation.odoo-community.org/projects/server-auth-11-0/server-auth-11-0-auth_brute_force/it/
Currently translated at 62.5% (15 of 24 strings) Translation: server-auth-11.0/server-auth-11.0-auth_brute_force Translate-URL: https://translation.odoo-community.org/projects/server-auth-11-0/server-auth-11-0-auth_brute_force/it/
Currently translated at 62.5% (15 of 24 strings) Translation: server-auth-11.0/server-auth-11.0-auth_brute_force Translate-URL: https://translation.odoo-community.org/projects/server-auth-11-0/server-auth-11-0-auth_brute_force/it/
cfc5b23 to
290649d
Compare
legalsylvain
left a comment
There was a problem hiding this comment.
Hi. Thanks for porting this module !
Could you create readme fragments in a new folder readme ? (as per other OCA modules ? )
thanks !
Otherwise, LGTM. Code review / no test.
290649d to
14bdfd0
Compare
|
I added "readme" fragments as requested. |
auth_brute_force/readme/ROADMAP.md
Outdated
| @@ -0,0 +1,12 @@ | |||
| * Remove 🐒 patch for https://github.com/odoo/odoo/issues/24183 in v12. | |||
There was a problem hiding this comment.
Do you think if this roadmap section is still valid ?or obsolete ?
There was a problem hiding this comment.
(you removed the according code in the python file)
| def strtobool(val): | ||
| val = str(val).strip().lower() | ||
| if val in ("y", "yes", "true", "t", "1", "on"): | ||
| return True | ||
| elif val in ("n", "no", "false", "f", "0", "off"): | ||
| return False | ||
| else: | ||
| raise ValueError(f"Invalid truth value: {val}") | ||
|
|
||
|
|
There was a problem hiding this comment.
odoo removed this function. I think we can remove it also.
correct value are True or False.
| check_remote = strtobool( | ||
| self.env["ir.config_parameter"] | ||
| .sudo() | ||
| .get_param("auth_brute_force.check_remote", "True") |
There was a problem hiding this comment.
.get_param("auth_brute_force.check_remote", "True")
->
.get_param("auth_brute_force.check_remote", True)
auth_brute_force/readme/ROADMAP.md
Outdated
| @@ -0,0 +1,12 @@ | |||
| * Remove 🐒 patch for https://github.com/odoo/odoo/issues/24183 in v12. | |||
There was a problem hiding this comment.
(you removed the according code in the python file)
auth_brute_force/models/res_users.py
Outdated
|
|
||
| @classmethod | ||
| def authenticate(cls, db, login, password, user_agent_env): | ||
| def authenticate(cls, db, password, user_agent_env): |
There was a problem hiding this comment.
The V18 signature is
def authenticate(cls, db, credential, user_agent_env):
auth_brute_force/models/res_users.py
Outdated
| # Override all auth-related core methods | ||
| @classmethod | ||
| def _login(cls, db, login, password): | ||
| def _login(cls, db, password, user_agent_env): |
There was a problem hiding this comment.
the correct signature is
def _login(cls, db, credential, user_agent_env):
0899d7e to
d1c4800
Compare
d1c4800 to
d70b89c
Compare
No description provided.