Refactor LoginController

PHRAS-529 #time 2h
This commit is contained in:
Benoît Burnichon
2015-06-18 16:53:03 +02:00
parent 3e6a8190f5
commit ca5e6772f6
6 changed files with 507 additions and 293 deletions

View File

@@ -65,7 +65,7 @@ class AccountController extends Controller
}
return $this->render('account/change-password.html.twig', array_merge(
$this->getLoginController()->getDefaultTemplateVariables($this->app),
$this->getLoginController()->getDefaultTemplateVariables($request),
['form' => $form->createView()]
));
}
@@ -151,7 +151,7 @@ class AccountController extends Controller
return $this->app->redirectPath('account');
}
$context = $this->getLoginController()->getDefaultTemplateVariables($this->app);
$context = $this->getLoginController()->getDefaultTemplateVariables($request);
return $this->render('account/reset-email.html.twig', $context);
}

File diff suppressed because it is too large Load Diff

View File

@@ -28,6 +28,8 @@ class Login implements ControllerProviderInterface, ServiceProviderInterface
$app['login.controller'] = $app->share(function (PhraseaApplication $app) {
return (new LoginController($app))
->setDelivererLocator(new LazyLocator($app, 'notification.deliverer'))
->setDispatcher($app['dispatcher'])
->setEntityManagerLocator(new LazyLocator($app, 'orm.em'))
;
});
}

View File

@@ -12,6 +12,7 @@
namespace Alchemy\Phrasea\Model\Repositories;
use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Model\Entities\UsrAuthProvider;
use Doctrine\ORM\EntityRepository;
/**
@@ -22,6 +23,10 @@ use Doctrine\ORM\EntityRepository;
*/
class UsrAuthProviderRepository extends EntityRepository
{
/**
* @param User $user
* @return UsrAuthProvider[]
*/
public function findByUser(User $user)
{
$dql = 'SELECT u
@@ -36,6 +41,12 @@ class UsrAuthProviderRepository extends EntityRepository
return $query->getResult();
}
/**
* @param $providerId
* @param $distantId
* @return UsrAuthProvider|null
* @throws \Doctrine\ORM\NonUniqueResultException
*/
public function findWithProviderAndId($providerId, $distantId)
{
$dql = 'SELECT u

View File

@@ -11,6 +11,7 @@
namespace Alchemy\Phrasea\Model\Repositories;
use Alchemy\Phrasea\Model\Entities\ValidationParticipant;
use Doctrine\ORM\EntityRepository;
use Doctrine\DBAL\Types\Type;
@@ -21,7 +22,7 @@ class ValidationParticipantRepository extends EntityRepository
* Retrieve all not reminded participants where the validation has not expired
*
* @param $expireDate The expiration Date
* @return array
* @return ValidationParticipant[]
*/
public function findNotConfirmedAndNotRemindedParticipantsByExpireDate(\DateTime $expireDate)
{

View File

@@ -37,7 +37,7 @@ abstract class AbstractMailWithLink extends AbstractMail implements MailWithLink
* @param string $url
* @param \DateTime $expiration
*
* @return MailWithLinkInterface
* @return static
*/
public static function create(Application $app, ReceiverInterface $receiver, EmitterInterface $emitter = null, $message = null, $url = null, \DateTime $expiration = null)
{