add resend functionality

This commit is contained in:
Antonio Ramirez
2016-12-09 01:39:55 +01:00
parent 6f9cc5188e
commit c3aad1b47d
11 changed files with 310 additions and 53 deletions

View File

@ -0,0 +1,38 @@
<?php
namespace Da\User\Service;
use Da\User\Contracts\ServiceInterface;
use Da\User\Factory\TokenFactory;
use Da\User\Helper\SecurityHelper;
use Da\User\Model\Token;
use Da\User\Model\User;
use Da\User\Query\UserQuery;
use yii\log\Logger;
class ResendConfirmationService implements ServiceInterface
{
protected $model;
protected $mailService;
protected $logger;
public function __construct(User $model, MailService $mailService, Logger $logger)
{
$this->model = $model;
$this->mailService = $mailService;
$this->logger = $logger;
}
public function run()
{
if($this->model && !$this->model->getIsConfirmed()) {
$token = TokenFactory::makeConfirmationToken($this->model->id);
$this->mailService->setViewParam('token', $token);
return $this->mailService->run();
}
return false;
}
}