Commit a59a5e5d authored by Laurent Lécluse's avatar Laurent Lécluse
Browse files

Utilisation de la procédure de changement de mot de passe d'UnicaenAuth par défaut

parent 76a99c69
......@@ -90,8 +90,8 @@ return [
],
],
'controllers' => [
'invokables' => [
'Application\Controller\Administration' => Controller\AdministrationController::class,
'factories' => [
'Application\Controller\Administration' => Controller\Factory\AdministrationControllerFactory::class,
],
],
];
\ No newline at end of file
......@@ -3,6 +3,7 @@
namespace Application\Controller;
use Application\Service\Traits\UtilisateurServiceAwareTrait;
use UnicaenAuth\Service\Traits\UserServiceAwareTrait;
/**
......@@ -14,13 +15,10 @@ use Application\Service\Traits\UtilisateurServiceAwareTrait;
class AdministrationController extends AbstractController
{
use UtilisateurServiceAwareTrait;
use UserServiceAwareTrait;
/**
*
* @return type
*/
public function indexAction()
{
return [];
......@@ -38,7 +36,10 @@ class AdministrationController extends AbstractController
throw new \Exception("Utilisateur $utilisateur non trouvé");
}
$userObject->setPassword($motDePasse, true);
$this->getServiceUtilisateur()->save($userObject);
if (strlen($motDePasse) < 6){
throw new \Exception("Mot de passe trop court : il doit faire au moint 6 caractères");
}
$this->userService->updateUserPassword( $userObject, $motDePasse);
}
}
\ No newline at end of file
<?php
namespace Application\Controller\Factory;
use Application\Controller\AdministrationController;
use Zend\Mvc\Controller\ControllerManager;
class AdministrationControllerFactory
{
/**
* Create controller
*
* @param ControllerManager $controllerManager
*
* @return AdministrationController
*/
public function __invoke(ControllerManager $controllerManager)
{
$controller = new AdministrationController();
$controller->setUserService( $controllerManager->getServiceLocator()->get('UnicaenAuth\Service\User') );
return $controller;
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment