-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Family External Information Verify (#1570)
* 1st commit for verify code working views - enter data - view family * add get people by Role * fixed get photo * using SystemURLs::getDocumentRoot() * added getPeopleSorted * sRootPath = SystemURLs::getRootPath() * no longer passing sRootPath * people are displayed in order * added Tokens table * removed invalid head Classification * added missing SystemURLs use * fixed ORM debug string * verify by token is working * added valid token check * Renamed the class token not tokens * final tokens table sql * check to make sure we have the family in the db before rendering * fixed renaming * added more helper methdos and new isValid Logic * added verify api to create the token for now * php cleanup * added getId * moved FamilyVerify to API call * Moved family verify to API call * moved verifyDownloadPDF to button click and remove Email PDF * there is no role 7 * Send Email with Verification Token * Moved Confirm PDF email to Email Classes * Moved ConfirmReport to Member Dashbaord No need to hide it * removed unsued buttons * created BaseFamilyVerification * added default index to getURL * MVP no self request of the info * moved JS to new JS file * passing token to page * new flooting buttons for verify/update/remove info * now consume a use if a token has a max count * Update Token Table - renamed useCount to setRemainingUses - updated verify to verifyFamily - added verifyPerson * renamed emails var to toAddresses * updated route to /families/{id}/family * default auth on smtp is off * fixed naming issue * Single verify button * added gettext where missing * added 404 page * check group size * select verification * adding note when user submits info * submit data and handle errors * fixed getSendNewsletter * fixed SMTP * delete old token for the fmaily * format cleanup * Updated Confirm button with text also * Apply fixes from StyleCI (#1619)
- Loading branch information
Showing
34 changed files
with
1,957 additions
and
1,150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
namespace ChurchCRM\Emails; | ||
|
||
use ChurchCRM\dto\SystemConfig; | ||
|
||
class BaseEmail | ||
{ | ||
protected $ChurchName; | ||
/** @var \PHPMailer */ | ||
protected $mail; | ||
|
||
public function __construct($toAddresses) | ||
{ | ||
$this->setConnection(); | ||
$this->ChurchName = SystemConfig::getValue("sChurchName"); | ||
$this->mail->setFrom(SystemConfig::getValue("sChurchEmail"), $this->ChurchEmail); | ||
foreach ($toAddresses as $email) { | ||
$this->mail->addAddress($email); | ||
} | ||
} | ||
|
||
private function setConnection() | ||
{ | ||
|
||
$this->mail = new \PHPMailer(); | ||
$this->mail->IsSMTP(); | ||
$this->mail->CharSet = 'UTF-8'; | ||
$this->mail->Host = SystemConfig::getValue("sSMTPHost"); | ||
if (SystemConfig::getBooleanValue("sSMTPAuth")) { | ||
$this->mail->SMTPAuth = true; | ||
$this->mail->Username = SystemConfig::getValue("sSMTPUser"); | ||
$this->mail->Password = SystemConfig::getValue("sSMTPPass"); | ||
} | ||
//$this->mail->SMTPDebug = 2; | ||
} | ||
|
||
public function send(){ | ||
return $this->mail->send(); | ||
} | ||
|
||
public function getError(){ | ||
return $this->mail->ErrorInfo; | ||
} | ||
|
||
public function addStringAttachment($string,$filename) { | ||
$this->mail->addStringAttachment($string,$filename); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
namespace ChurchCRM\Emails; | ||
|
||
use ChurchCRM\dto\SystemConfig; | ||
|
||
abstract class BaseFamilyVerification extends BaseEmail | ||
{ | ||
|
||
protected $familyName; | ||
|
||
public function __construct($emails, $familyName) | ||
{ | ||
parent::__construct($emails); | ||
$this->familyName = $familyName; | ||
$this->mail->Subject = gettext($familyName . ": " . gettext("Please verify your family's information")); | ||
$this->mail->isHTML(true); | ||
$this->mail->msgHTML($this->buildMessage()); | ||
} | ||
|
||
protected function buildMessage(){ | ||
$msg = array(); | ||
array_push($msg, $this->buildMessageHeader()); | ||
array_push($msg, $this->buildMessageBody()); | ||
array_push($msg, $this->buildMessageFooter()); | ||
return implode("<p/>", $msg); | ||
} | ||
|
||
protected function buildMessageHeader() | ||
{ | ||
return gettext("Dear") ." " . $this->familyName . " " . gettext("Family"); | ||
} | ||
|
||
protected function buildMessageFooter() | ||
{ | ||
return gettext("Sincerely") . "<br/>" . SystemConfig::getValue("sConfirmSigner"); | ||
} | ||
|
||
protected abstract function buildMessageBody(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
namespace ChurchCRM\Emails; | ||
use ChurchCRM\dto\SystemURLs; | ||
|
||
class FamilyVerificationEmail extends BaseFamilyVerification | ||
{ | ||
|
||
private $link; | ||
|
||
public function __construct($emails, $familyName, $token) | ||
{ | ||
$this->link = SystemURLs::getURL() . "external/verify/" . $token; | ||
parent::__construct($emails, $familyName); | ||
} | ||
|
||
protected function buildMessageBody() { | ||
return "<a href='".$this->link."'>".$this->link."</a>"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
namespace ChurchCRM\Emails; | ||
|
||
use ChurchCRM\dto\SystemConfig; | ||
use ChurchCRM\dto\SystemURLs; | ||
|
||
class FamilyVerificationPDFEmail extends BaseFamilyVerification | ||
{ | ||
|
||
protected function buildMessageBody() { | ||
return SystemConfig::getValue("sConfirm1"); | ||
} | ||
|
||
} |
Oops, something went wrong.