Skip to content

Commit

Permalink
more deprecated messages removed
Browse files Browse the repository at this point in the history
  • Loading branch information
jordisala1991 committed Feb 3, 2017
1 parent 45f6fff commit 53849fd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 10 additions & 2 deletions Controller/AdminResettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ class AdminResettingController extends ResettingController
*/
public function requestAction()
{
if ($this->container->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) {
// NEXT_MAJOR: remove when dropping Symfony <2.8 support
$authorizationCheckerService = $this->container->has('security.authorization_checker')
? $this->container->get('security.authorization_checker') : $this->container->get('security.context');

if ($authorizationCheckerService->isGranted('IS_AUTHENTICATED_FULLY')) {
return new RedirectResponse($this->container->get('router')->generate('sonata_admin_dashboard'));
}

Expand Down Expand Up @@ -102,7 +106,11 @@ public function checkEmailAction()
*/
public function resetAction($token)
{
if ($this->container->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) {
// NEXT_MAJOR: remove when dropping Symfony <2.8 support
$authorizationCheckerService = $this->container->has('security.authorization_checker')
? $this->container->get('security.authorization_checker') : $this->container->get('security.context');

if ($authorizationCheckerService->isGranted('IS_AUTHENTICATED_FULLY')) {
return new RedirectResponse($this->container->get('router')->generate('sonata_admin_dashboard'));
}

Expand Down
6 changes: 5 additions & 1 deletion Controller/SecurityFOSUser1Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ class SecurityFOSUser1Controller extends SecurityController
*/
public function loginAction()
{
$token = $this->container->get('security.context')->getToken();
// NEXT_MAJOR: remove when dropping Symfony <2.8 support
$tokenStorageService = $this->container->has('security.token_storage')
? $this->container->get('security.token_storage') : $this->container->get('security.context');

$token = $tokenStorageService->getToken();

if ($token && $token->getUser() instanceof UserInterface) {
$this->container->get('session')->getFlashBag()->set('sonata_user_error', 'sonata_user_already_authenticated');
Expand Down

0 comments on commit 53849fd

Please sign in to comment.