1 | <?php |
||
2 | |||
3 | /* |
||
4 | * @copyright 2014 Mautic Contributors. All rights reserved |
||
5 | * @author Mautic |
||
6 | * |
||
7 | * @link http://mautic.org |
||
8 | * |
||
9 | * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html |
||
10 | */ |
||
11 | |||
12 | namespace Mautic\ApiBundle\Controller\oAuth2; |
||
13 | |||
14 | use Mautic\CoreBundle\Controller\CommonController; |
||
15 | use Symfony\Component\HttpFoundation\Request; |
||
16 | use Symfony\Component\HttpFoundation\Response; |
||
17 | use Symfony\Component\Security\Core\Exception as Exception; |
||
18 | use Symfony\Component\Security\Core\Security; |
||
19 | |||
20 | class SecurityController extends CommonController |
||
21 | { |
||
22 | /** |
||
23 | * @return \Symfony\Component\HttpFoundation\Response |
||
24 | */ |
||
25 | public function loginAction(Request $request) |
||
26 | { |
||
27 | $session = $request->getSession(); |
||
28 | |||
29 | //get the login error if there is one |
||
30 | if ($request->attributes->has(Security::AUTHENTICATION_ERROR)) { |
||
31 | $error = $request->attributes->get(Security::AUTHENTICATION_ERROR); |
||
32 | } else { |
||
33 | $error = $session->get(Security::AUTHENTICATION_ERROR); |
||
34 | $session->remove(Security::AUTHENTICATION_ERROR); |
||
35 | } |
||
36 | if (!empty($error)) { |
||
37 | if (($error instanceof Exception\BadCredentialsException)) { |
||
38 | $msg = 'mautic.user.auth.error.invalidlogin'; |
||
39 | } else { |
||
40 | $msg = $error->getMessage(); |
||
41 | } |
||
42 | $this->addFlash($msg, [], 'error', null, false); |
||
0 ignored issues
–
show
|
|||
43 | } |
||
44 | |||
45 | if ($session->has('_security.target_path')) { |
||
46 | if (false !== strpos($session->get('_security.target_path'), $this->generateUrl('fos_oauth_server_authorize'))) { |
||
47 | $session->set('_fos_oauth_server.ensure_logout', true); |
||
48 | } |
||
49 | } |
||
50 | |||
51 | return $this->render( |
||
52 | 'MauticApiBundle:Security:login.html.php', |
||
53 | [ |
||
54 | 'last_username' => $session->get(Security::LAST_USERNAME), |
||
55 | 'route' => 'mautic_oauth2_server_auth_login_check', |
||
56 | ] |
||
57 | ); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @return Response |
||
62 | */ |
||
63 | public function loginCheckAction() |
||
64 | { |
||
65 | return new Response('', 400); |
||
66 | } |
||
67 | } |
||
68 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.