İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
1171 Görünümler

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
Vazgeç
Üretici En İyi Yanıt


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
Vazgeç
En İyi Yanıt

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

Thanks

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Oca 25
5718
1
Oca 20
9046
0
Şub 23
2276
3
Eki 19
6100
0
Ağu 21
4536