Modify

Opened 8 years ago

Closed 12 days ago

#7022 closed defect (fixed)

validate_author won't validate email address stored in trac preferences.

Reported by: andrew.beck@… Owned by: Richard Liao
Priority: normal Component: TracTicketValidatorPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description (last modified by Ryan J Ollos)

When using the following config in trac.ini

[components]
ticketvalidator.* = enabled

[ticketvalidator]
validate_author = true
validate_author.tip = Please fill your valid email address

and an anonymous user saves his email in trac preferences cookie e.g. http://hostname/projects/pathtoproject/prefs

then the Author field becomes something like Andrew Beck <andrew.beck@nokia.com> which fails validation where just andrew.beck@nokia.com works.

Attachments (0)

Change History (4)

comment:1 Changed 7 years ago by lee.calabrese@…

This ticket is over 11 months old, but I just ran into the same problem, which I was able to fix relatively quickly. I don't believe this has any side-effects as I just changed the regex to also accept email addresses in the form "Name <email@…>".

--- ticketvalidator.py~ 2010-01-05 03:35:32.000000000 -0800
+++ ticketvalidator.py  2011-03-06 21:34:17.000000000 -0800
@@ -89,7 +89,7 @@
             return False

         if len(email) > 7:
-            if re.match("^[a-zA-Z0-9._%-]+@[a-zA-Z0-9._%-]+\.[a-zA-Z]{2,6}$", email) != None:
+            if re.match("^(?P<named>.*? <){,1}[a-zA-Z0-9._%-]+@[a-zA-Z0-9._%-]+\.[a-zA-Z]{2,6}(?(named)>)$", email) != None:
                 return True
         return False

comment:2 Changed 12 days ago by Ryan J Ollos

Description: modified (diff)

comment:3 Changed 12 days ago by Ryan J Ollos

#8829 closed as a duplicate.

comment:4 Changed 12 days ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

In 17106:

TracTicketValidator 0.4: Allow name + email

Patch by lee.calabrese@….

Fixes #7022.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Richard Liao.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.