Skip to content

Validate email addresses everywhere they are set. - #3244

Open
drgrice1 wants to merge 1 commit into
openwebwork:developfrom
drgrice1:validate-email-address-when-set
Open

drgrice1 wants to merge 1 commit into
openwebwork:developfrom
drgrice1:validate-email-address-when-set

Conversation

@drgrice1

Copy link
Copy Markdown
Member

Add an isValidEmailAddress method to WeBWorK::Utils that uses Email::Address::XS to check that an email address is valid, and use it wherever a user's email address is set (other than from an LMS via LTI).

  • Account Settings page: An invalid new address is rejected with a message.
  • Classlist editor: An invalid address is rejected with a message and the user's address is left unchanged. An empty address is still allowed.
  • Classlist import (both from the classlist editor and the importClassList.pl and addcourse scripts): An invalid address is replaced with an empty address and the user is still imported, and the affected users are reported.
  • Add Users page: A user with an invalid address is not added and the reason is shown in the report.
  • Course Administration add course form: An invalid address for an additional user is a validation error.
  • Course actions API addUser method: Adding a new user with an invalid address returns an error.
  • Feedback page: The sender's address is validated with the same method instead of a custom regular expression.

@drgrice1
drgrice1 force-pushed the validate-email-address-when-set branch from 75c6c3d to 07ccd41 Compare October 16, 2026 17:38
@pstaabp

pstaabp commented Oct 20, 2026

Copy link
Copy Markdown
Member

This looks like it is detecting bad emails everywhere they can be entered.

I was testing in the Add users section of the Accounts Manager and putting it a bad email address gives the message but clears all of the input. I realize this is a the same behavior as before but could we instead keep the previous input in each box and perhaps put a red outline around the email box--this could be done for the login name as well.

@drgrice1
drgrice1 force-pushed the validate-email-address-when-set branch from 07ccd41 to 7625d8a Compare October 20, 2026 19:25

@pstaabp pstaabp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Add an `isValidEmailAddress` method to `WeBWorK::Utils` that uses
Email::Address::XS to check that an email address is valid, and use it
wherever a user's email address is set (other than from an LMS via LTI).

* Account Settings page: An invalid new address is rejected with a
  message.
* Classlist editor: An invalid address is rejected with a message and
  the user's address is left unchanged. An empty address is still
  allowed.
* Classlist import (both from the classlist editor and the
  `importClassList.pl` and `addcourse` scripts): An invalid address is
  replaced with an empty address and the user is still imported, and the
  affected users are reported.
* Add Users page: A user with an invalid address is not added and the
  reason is shown in the report.
* Course Administration add course form: An invalid address for an
  additional user is a validation error.
* Course actions API addUser method: Adding a new user with an invalid
  address returns an error.
* Feedback page: The sender's address is validated with the same method
  instead of a custom regular expression.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@drgrice1
drgrice1 force-pushed the validate-email-address-when-set branch from 7625d8a to 45e29aa Compare October 20, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants