mraible commented on code in PR #400:
URL: https://github.com/apache/roller/pull/400#discussion_r4711787923


##########
app/src/main/resources/org/apache/roller/weblogger/ui/struts2/editor/WeblogConfig-validation.xml:
##########
@@ -20,7 +20,22 @@
             <message key="WeblogConfig.error.descriptionSize">unspecified 
key</message>
         </field-validator>
     </field>
-
+    
+    <field name="bean.emailAddress">

Review Comment:
   Since these run on every save, a weblog whose stored owner email is empty or 
fails this check can't save any Weblog Settings change until the owner fixes 
the email. Create Weblog has validated the email the same way for years, so 
this should only affect addresses that came in some other way, such as seeded 
data like `admin@localhost` or direct database edits. I didn't set one up to 
try, but it might be worth a sentence in the CHANGES entry.



##########
CHANGES.md:
##########
@@ -187,6 +187,8 @@
 - **Only the site's first account becomes an administrator.** With
   `users.firstUserAdmin` on, a new account was made an administrator whenever
   no enabled account existed. Disabled accounts now count too.
+- **Saving Weblog Settings does not validate email address.** Makes sure the

Review Comment:
   This reads like the current behaviour. The other bullets say what happens 
now, so maybe something like "**Weblog Settings checks the owner's email 
address.** A missing or badly formatted address is now rejected when saving."



##########
app/src/main/resources/org/apache/roller/weblogger/ui/struts2/editor/WeblogConfig-validation.xml:
##########
@@ -20,7 +20,22 @@
             <message key="WeblogConfig.error.descriptionSize">unspecified 
key</message>
         </field-validator>
     </field>
-
+    
+    <field name="bean.emailAddress">
+        <field-validator type="requiredstring">
+            <message key="CreateWeblog.error.emailAddressNull">unspecified 
key</message>
+        </field-validator>
+        
+        <field-validator type="stringlength">
+            <param name="maxLength">255</param>
+            <message key="CreateWeblog.error.emailAddressSize">unspecified 
key</message>
+        </field-validator>
+        
+        <field-validator type="email">

Review Comment:
   The validators trim the value before checking it, but `WeblogConfig.save()` 
stores the untrimmed value. I confirmed it on Jetty: `" [email protected] "` 
saves with the spaces. Trimming `bean.emailAddress` in `save()` before 
`copyTo`, the way `analyticsCode` is trimmed, would fix that.



##########
app/src/main/resources/org/apache/roller/weblogger/ui/struts2/editor/WeblogConfig-validation.xml:
##########
@@ -20,7 +20,22 @@
             <message key="WeblogConfig.error.descriptionSize">unspecified 
key</message>
         </field-validator>
     </field>
-
+    
+    <field name="bean.emailAddress">
+        <field-validator type="requiredstring">
+            <message key="CreateWeblog.error.emailAddressNull">unspecified 
key</message>
+        </field-validator>
+        
+        <field-validator type="stringlength">
+            <param name="maxLength">255</param>

Review Comment:
   Older than this PR: the field in `WeblogConfig.jsp` (line 47) still has 
`maxlength="40"`, so the browser cuts anything longer before this 255 limit is 
checked. Raising it to 255 would match this and the column.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to