@@ -280,35 +280,57 @@ yourself::
280
280
}
281
281
}
282
282
283
- And the corresponding template::
283
+ And the corresponding template:
284
284
285
- <?php if ($error): ?>
286
- <div><?php echo $error ?></div>
287
- <?php endif; ?>
285
+ .. configuration-block ::
286
+
287
+ .. code-block :: html+php
288
+
289
+ <?php if ($error): ?>
290
+ <div><?php echo $error ?></div>
291
+ <?php endif; ?>
292
+
293
+ <form action="<?php echo $view['router']->generate('_security_check') ?>" method="post">
294
+ <label for="username">Username:</label>
295
+
296
+ <input type="text" id="username" name="_username" value="<?php echo $last_username ?>" />
297
+ <label for="password">Password:</label>
298
+ <input type="password" id="password" name="_password" />
288
299
289
- <form action="/_login_check" method="post" >
290
- <label for="username">Username:</label >
300
+ <input type="submit" name="login" / >
301
+ </form >
291
302
292
- <input type="text" id="username" name="_username" value="<?php echo $last_username ?>" />
293
- <label for="password">Password:</label>
294
- <input type="password" id="password" name="_password" />
303
+ .. code-block :: jinja
295
304
296
- <input type="submit" name="login" />
297
- </form>
305
+ {% if error %}
306
+ <div>{{ error }}</div>
307
+ {% endif %}
308
+
309
+ <form action="{% route "_security_check" %}" method="post">
310
+ <label for="username">Username:</label>
311
+
312
+ <input type="text" id="username" name="_username" value="{{ last_username }}" />
313
+ <label for="password">Password:</label>
314
+ <input type="password" id="password" name="_password" />
315
+
316
+ <input type="submit" name="login" />
317
+ </form>
298
318
299
319
The template must have a ``_username `` and ``_password `` fields, and the form
300
320
submission URL must be the value of the ``check_path `` setting
301
321
(``/login_check `` by default).
302
322
303
- Finally, you will need to route the controller to the ``/login `` URL
304
- (``login_path `` value):
323
+ Finally, add routes for the ``/login `` (`` login_path `` value) and
324
+ `` /_login_check `` (``login_check `` value) URLs :
305
325
306
326
.. code-block :: xml
307
327
308
328
<route id =" _security_login" pattern =" /login" >
309
329
<default key =" _controller" >SecurityBundle:Security:login</default >
310
330
</route >
311
331
332
+ <route id =" _security_check" pattern =" /_login_check" />
333
+
312
334
After an authentication failure, the user is redirected to the login page. You
313
335
can use forward instead by setting the ``failure_forward `` to ``true ``. You
314
336
can also redirect or forward to another page if you set the ``failure_path ``
0 commit comments