{#========================================== Demos - Form Validation ==========================================#} {% extends "../demos.html" %} {% block subSectionClasses %}demo_form_validation{% endblock %} {% block meta_title %}Demo - Form Validation{% endblock %} {% block meta_description %}For Validation demo using Spincast{% endblock %} {% block scripts %} {% endblock %} {% block subBody %}
The following form contains fields with various validation rules. There is no client-side validation except on the first field, since we want to show how the server-side validation is done. In a real application, you should probably add client-side validation on most field.
Things you can try to test the validation :
Protecting a resource or a set of resources with HTTP authentication
is very easy. You simply use the httpAuth(...) method
of the router. You specify the route to protect and a name to identify that "realm"
(the protected section).
router.httpAuth("/route/to/protect", "protected example");
The resource is then protected!
But how do you specify which username/password combinations
are allowed to access that realm? You use the addHttpAuthentication(...) method
of the server instance. You specify the name of the realm and a username/password
allowed to access it. Of course, you can add more that one credential for the same realm!
server.addHttpAuthentication("protected example", "Stromgol", "Laroche")
Learn more about HTTP Authentication in the documentation.