]>
Commit | Line | Data |
---|---|---|
1 | package Gruntmaster::Page::Account; | |
2 | ||
3 | use 5.014000; | |
4 | use strict; | |
5 | use warnings; | |
6 | use parent qw/Exporter/; | |
7 | our @EXPORT_OK = qw/generate/; | |
8 | our $VERSION = '0.001'; | |
9 | ||
10 | use HTML::Template::Compiled; | |
11 | use Gruntmaster::Page::Common qw/cook_templates reload_templates/; | |
12 | ||
13 | my %orig_templates = ( | |
14 | en => <<'HTML', | |
15 | <div id="result"></div> | |
16 | ||
17 | <h1>Register</h1> | |
18 | <form action="/action/register" method="POST" class="jsform"> | |
19 | Username:<br> | |
20 | <input type="text" name="username" required><br> | |
21 | Password:<br> | |
22 | <input type="password" name="password" required><br> | |
23 | Confirm password:<br> | |
24 | <input type="password" name="confirm_password" required><br> | |
25 | Full name:<br> | |
26 | <input type="text" name="name" required><br> | |
27 | Email:<br> | |
28 | <input type="email" name="email" required><br> | |
29 | Town:<br> | |
30 | <input type="text" name="town" required><br> | |
31 | University <i>(full name)</i>:<br> | |
32 | <input type="text" name="university" required><br> | |
33 | <input type="submit" value="Register"> | |
34 | </form> | |
35 | ||
36 | <h1>Change password</h1> | |
37 | <form action="/action/passwd" method="POST" class="jsform"> | |
38 | Old password:<br> | |
39 | <input type="password" name="password" required><br> | |
40 | New password:<br> | |
41 | <input type="password" name="new_password" required><br> | |
42 | Confirm new password:<br> | |
43 | <input type="password" name="confirm_new_password" required><br> | |
44 | <input type="submit" value="Change password"> | |
45 | </form> | |
46 | HTML | |
47 | ); | |
48 | ||
49 | my %templates = cook_templates %orig_templates, account => 'Account'; | |
50 | ||
51 | sub generate{ | |
52 | %templates = cook_templates %orig_templates, account => 'Account' if reload_templates; | |
53 | HTML::Template::Compiled->new(scalarref => \$templates{$_[1]})->output | |
54 | } | |
55 | ||
56 | 1 |