I have a task to make a registration module with a register form view, inside it I need the fields of email and password to be validated (using regular expressions)
how can I do this?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I have a task to make a registration module with a register form view, inside it I need the fields of email and password to be validated (using regular expressions)
how can I do this?
Hi,You can do validate the email and password fields using regular expressions according to the below code:
@api.constrains('email')
def _check_email(self):
for record in self:
if record.email and not re.match(r"[^@]+@[^@]+\.[^@]+", record.email):
raise ValueError("Invalid email format")
@api.constrains('password')
def _check_password(self):
for record in self:
if record.password and not re.match(r"^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$", record.password):
raise ValueError("Invalid password format. It must
contain at least 8 characters, including one letter and one digit.")
Hope it helps
thank you for help. I am wondering if we can have a conversion because I have a couple of questions to be asked.
you can find me on LinkedIn if you have enough time
https://www.linkedin.com/in/dana-kaplan/
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
|
2
ธ.ค. 19
|
24813 | ||
|
0
ส.ค. 24
|
1005 | ||
|
1
ธ.ค. 19
|
5233 | ||
|
1
มิ.ย. 19
|
13464 | ||
insert into database the input fields
แก้ไขแล้ว
|
|
1
ก.ย. 18
|
13226 |