Validating html registration form in perl radio carbon dating accuracy
A few days ago I pushed to Git Hub a sample web application written in the MVC style with Dancer2 and DBIx:: Class.
In this very first post about it, I'd like to highlight how a route block that processes and validates form data can be made short and neat with the help of HTML:: Form Handler.
It should look like this: The form above can be tested in the same way as the earlier examples by sending it to the script.
Note that the POST method is used to allow the input fields to be of any length.
Web forms are easy to create using a web authoring tool or by typing the necessary HTML tags directly into a text editor and displaying them using a web browser.
These basic features require special care; they need to be simple, fast and secure for the user.
If the purpose of registration is to confirm that the person exists, and that they have supplied a valid email address, then as part of the registration processe you a should either email them a random password or a confirmation token rather than letting them choose their own password and use it immediately.
The code presented below would then be used for letting the user change their password.
Otherwise, a new account gets created automatically and the user finds himself on the welcome page already logged in. I hope this post helps you save some typing in your next Dancer2 project. Dancer is a great framework but we need more indepth examples like this (that utilise things like MVC, DBIC and HFH) to help people get their heads around how they can use it in real life situations.
I know there are Catalyst examples but it's nice to see something up to date done in Dancer.