]>
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 constant TITLE => 'Account'; | |
11 | ||
12 | use HTML::Template::Compiled; | |
13 | use Gruntmaster::Page::Common qw/header footer patch_templates/; | |
14 | ||
15 | my %templates = ( | |
16 | en => <<'HTML', | |
17 | <div id="result"></div> | |
18 | ||
19 | <h1>Register</h1> | |
20 | <form action="/action/register" method="POST" class="jsform"> | |
21 | Username:<br> | |
22 | <input type="text" name="username" required><br> | |
23 | Password:<br> | |
24 | <input type="password" name="password" required><br> | |
25 | Confirm password:<br> | |
26 | <input type="password" name="confirm_password" required><br> | |
27 | Full name:<br> | |
28 | <input type="text" name="name" required><br> | |
29 | Email:<br> | |
30 | <input type="email" name="email" required><br> | |
31 | Town:<br> | |
32 | <input type="text" name="town" required><br> | |
33 | University <i>(full name)</i>:<br> | |
34 | <input type="text" name="university" required><br> | |
35 | <input type="submit" value="Register"> | |
36 | </form> | |
37 | ||
38 | <h1>Change password</h1> | |
39 | <form action="/action/passwd" method="POST" class="jsform"> | |
40 | Old password:<br> | |
41 | <input type="password" name="password" required><br> | |
42 | New password:<br> | |
43 | <input type="password" name="new_password" required><br> | |
44 | Confirm new password:<br> | |
45 | <input type="password" name="confirm_new_password" required><br> | |
46 | <input type="submit" value="Change password"> | |
47 | </form> | |
48 | HTML | |
49 | ); | |
50 | ||
51 | patch_templates %templates, 'account'; | |
52 | ||
53 | $templates{$_} = header($_, TITLE) . $templates{$_} for keys %templates; | |
54 | $templates{$_} .= footer $_ for keys %templates; | |
55 | ||
56 | sub generate{ | |
57 | HTML::Template::Compiled->new(scalarref => \$templates{$_[1]})->output | |
58 | } | |
59 | ||
60 | 1 |