| @@ 36-51 (lines=16) @@ | ||
| 33 | ||
| 34 | class AdminController extends AbstractController |
|
| 35 | { |
|
| 36 | public function login(Application $app, Request $request) |
|
| 37 | { |
|
| 38 | if ($app->isGranted('ROLE_ADMIN')) { |
|
| 39 | return $app->redirect($app->url('admin_homepage')); |
|
| 40 | } |
|
| 41 | ||
| 42 | /* @var $form \Symfony\Component\Form\FormInterface */ |
|
| 43 | $form = $app['form.factory'] |
|
| 44 | ->createNamedBuilder('', 'admin_login') |
|
| 45 | ->getForm(); |
|
| 46 | ||
| 47 | return $app->render('login.twig', array( |
|
| 48 | 'error' => $app['security.last_error']($request), |
|
| 49 | 'form' => $form->createView(), |
|
| 50 | )); |
|
| 51 | } |
|
| 52 | ||
| 53 | public function index(Application $app, Request $request) |
|
| 54 | { |
|
| @@ 32-46 (lines=15) @@ | ||
| 29 | ||
| 30 | class LoginController |
|
| 31 | { |
|
| 32 | public function index(Application $app, Request $request) |
|
| 33 | { |
|
| 34 | $email = $request->cookies->get('email'); |
|
| 35 | ||
| 36 | /* @var $form \Symfony\Component\Form\FormInterface */ |
|
| 37 | $form = $app['form.factory'] |
|
| 38 | ->createNamedBuilder('', 'customer_login') |
|
| 39 | ->getForm(); |
|
| 40 | ||
| 41 | return $app->render('Block/login.twig', array( |
|
| 42 | 'error' => $app['security.last_error']($request), |
|
| 43 | 'email' => $email, |
|
| 44 | 'form' => $form->createView(), |
|
| 45 | )); |
|
| 46 | } |
|
| 47 | } |
|
| 48 | ||