Skip to content

Commit

Permalink
Merge pull request #132 from phy25/email-validate
Browse files Browse the repository at this point in the history
Use DokuWiki's mail_isvalid to validate email address
  • Loading branch information
annda authored Feb 23, 2022
2 parents 85ca7af + 43aa359 commit 3cc4a04
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions action/banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,8 @@ function showBanner() {

global $INFO;
if ($this->getConf('apr_mail_receiver') !== '' && $INFO['isadmin']) {
$validator = new EmailAddressValidator();
$validator->allowLocalAddresses = true;
$addr = $this->getConf('apr_mail_receiver');
if(!$validator->check_email_address($addr)) {
if(!mail_isvalid($addr)) {
msg(sprintf($this->getLang('mail_invalid'),htmlspecialchars($addr)),-1);
}

Expand Down
6 changes: 2 additions & 4 deletions action/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ function send_change_mail(&$event, $param) {

// get mail receiver
$receiver = $this->getConf('apr_mail_receiver');
$validator = new EmailAddressValidator();
$validator->allowLocalAddresses = true;
if(!$validator->check_email_address($receiver)) {
dbglog(sprintf($this->getLang('mail_invalid'),htmlspecialchars($receiver)));
if(!mail_isvalid($receiver)) {
dbglog(sprintf($this->getLang('mail_invalid'), htmlspecialchars($receiver)));
return false;
}

Expand Down

0 comments on commit 3cc4a04

Please sign in to comment.