Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged

Odoo v17.  

https://apps.odoo.com/apps/modules/16.0/auth_user_case_insensitive/ isn't released for v17 yet.   



It's surpising how some sites still allow this.  I've seen conversations that support upper/lower case email addresses.  Can be problematic for some users.  I have also noticed that at times a trailing space could exist.


If you have run into this issue, here we go.


Steps to reproduce:

Sign up with a new email address: " new Customerwith spaces@gmail.com  "


Current behavior:

System allows account to be created


Expected behavior:

Should either provide an error or stirp out spaces and convert to lower 


Avatar
Zrušit
Autor Nejlepší odpověď


The code to add an oninput attribute to remove spaces and convert to lower case whenver anything is typed:

... oninput="this.value = this.value.toLowerCase().replace(/\s/g, '')

We're going to edit the signup HTML

Signup Page / account creation:  /web?debug=1#id=7066&cids=1&menu_id=43&action=30&model=ir.ui.view&view_type=form

Update this line:

input type="text" placeholder="Email" name="login" t-att-value="login" id="login" t-attf-class="form-control #{'form-control-sm' if form_small else ''}" required="required" autocomplete="username" autofocus="autofocus" autocapitalize="off"

New Code:

input type="text" name="login" t-att-value="login" id="login" class="form-control form-control-sm" autofocus="autofocus" autocapitalize="off" required="required" t-att-readonly="'readonly' if only_passwords else None" oninput="this.value = this.value.toLowerCase().replace(/\s/g, '')"



Login Page:  /web?debug=1#id=7066&cids=1&menu_id=43&action=30&model=ir.ui.view&view_type=form
Update the following code:

input type="text" placeholder="Email" name="login" t-att-value="login" id="login" t-attf-class="form-control #{'form-control-sm' if form_small else ''}" required="required" autocomplete="username" autofocus="autofocus" autocapitalize="off"

Updated code:

input type="text" placeholder="Email" name="login" t-att-value="login" id="login" t-attf-class="form-control #{'form-control-sm' if form_small else ''}" required="required" autocomplete="username" autofocus="autofocus" autocapitalize="off" oninput="this.value = this.value.toLowerCase().replace(/\s/g, '')"


This will work for all new logins.  However if you already have mixed-case email addresses, you may run into an issue.  I've seen an addon to go through existing data sets to rectify this. 


Hope this helps someone.



Avatar
Zrušit
Nejlepší odpověď

Hi, this might help you: https://youtu.be/An6YTH3kJD8

Thanks

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
led 25
5121
1
led 20
8612
0
úno 23
1909
3
říj 19
5694
0
srp 21
3895