Skip to content

Commit

Permalink
updating users app to user sendEvent Method when sending emails, and …
Browse files Browse the repository at this point in the history
…to use previewers
  • Loading branch information
ChrisFrench committed Aug 4, 2015
1 parent 3473b4a commit 942b2b4
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 3 deletions.
55 changes: 55 additions & 0 deletions src/Users/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,59 @@ public function registerEmails($event)
{
\Dsc\System::instance()->addMessage('Users added its admin menu items.');
}

public function mailerPreviewUsersVerify_change_email($event) {

$options = [];

$options['user'] = ['first_name'=> 'John', 'last_name' => 'Doe', 'email' => '[email protected]'];
$options['link'] = \Dsc\Url::base() . 'user/change-email/confirm?new_email&previewview';
$options['token'] = new \MongoId();


$event->setArgument('variables', $options);
}

public function mailerPreviewUsersPassword_reset_request($event) {

$options = [];

$options['user'] = ['first_name'=> 'John', 'last_name' => 'Doe', 'email' => '[email protected]', 'forgot_password' => ['token' => new \MongoId()]];
$options['link'] = \Dsc\Url::base() . 'user/change-email/confirm?new_email&previewview';
$options['token'] = new \MongoId();


$event->setArgument('variables', $options);
}

public function mailerPreviewUsersValidate_email($event) {

$options = [];

$options['user'] = ['id' => new \MongoId(),'first_name'=> 'John', 'last_name' => 'Doe', 'email' => '[email protected]', 'forgot_password' => ['token' => new \MongoId()]];
$options['link'] = \Dsc\Url::base() . 'user/change-email/confirm?new_email&previewview';
$options['token'] = new \MongoId();


$event->setArgument('variables', $options);
}

public function mailerPreviewUsersPassword_reset_notification($event) {

$options = [];

$options['user'] = ['id' => new \MongoId(),'first_name'=> 'John', 'last_name' => 'Doe', 'email' => '[email protected]', 'forgot_password' => ['token' => new \MongoId()]];
$options['link'] = \Dsc\Url::base() . 'user/change-email/confirm?new_email&previewview';
$options['token'] = new \MongoId();


$event->setArgument('variables', $options);
}







}
6 changes: 3 additions & 3 deletions src/Users/Models/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ public function sendEmailResetPassword()
if ($content = $mailer->getEmailContents('users.password_reset_request', array(
'user' => $this
))) {
$this->__sendEmailPasswordResetNotification = $mailer->send( $email, $content['subject'], $content['body'], $content['fromEmail'], $content['fromName'] );
$this->__sendEmailPasswordResetNotification = $mailer->sendEvent( $email, $content);
}

return $this;
Expand All @@ -621,7 +621,7 @@ public function sendEmailPasswordResetNotification()
if ($content = $mailer->getEmailContents('users.password_reset_notification', array(
'user' => $this
))) {
$this->__sendEmailPasswordResetNotification = $mailer->send( $email, $content['subject'], $content['body'], $content['fromEmail'], $content['fromName'] );
$this->__sendEmailPasswordResetNotification = $mailer->sendEvent( $email, $content);
}

return $this;
Expand All @@ -642,7 +642,7 @@ public function sendEmailChangeEmailConfirmation()
'link' => \Dsc\Url::base() . 'user/change-email/confirm?new_email=' . urlencode( $this->{'change_email.email'} ) . '&token=' . $this->{'change_email.token'},
'token' => $this->{'change_email.token'}
))) {
$this->__sendEmailPasswordResetNotification = $mailer->send( $email, $content['subject'], $content['body'], $content['fromEmail'], $content['fromName'] );
$this->__sendEmailPasswordResetNotification = $mailer->sendEvent( $email, $content);
}

return $this;
Expand Down

0 comments on commit 942b2b4

Please sign in to comment.