From 001ec7b2c20a58f95d79183e1f38db35fed88009 Mon Sep 17 00:00:00 2001 From: "Simon Genin (ges)" Date: Mon, 29 Aug 2022 09:26:20 +0000 Subject: [PATCH] [IMP] web: char field, password shouldn't be trimmed Passwords are something we know that need to be exact. So, the regular behaviour where double spaces are changed to single ones and spaces are trimmed at the start and end of the string is not a good idea for passwords in general. Not that a lot of people put double spaces or space in the start or end of their passwords, but it happened and it is possible. So, if password is True on the field, it does not make any sense to trim it and let's support that in the web client (as the web client does the trimming) instead of putting trim=False on all password fields in the Python, risking to forget it for the next password field. closes odoo/odoo#99088 Signed-off-by: Josse Colpaert --- addons/web/static/src/views/fields/char/char_field.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/views/fields/char/char_field.js b/addons/web/static/src/views/fields/char/char_field.js index b02396baba4..0eb5e0d0e52 100644 --- a/addons/web/static/src/views/fields/char/char_field.js +++ b/addons/web/static/src/views/fields/char/char_field.js @@ -46,7 +46,7 @@ CharField.supportedTypes = ["char"]; CharField.extractProps = ({ attrs, field }) => { return { - shouldTrim: field.trim, + shouldTrim: field.trim && !archParseBoolean(attrs.password), // passwords shouldn't be trimmed maxLength: field.size, isTranslatable: field.translate, autocomplete: attrs.autocomplete,