package Gruntmaster::Page::Account;

use 5.014000;
use strict;
use warnings;
use parent qw/Exporter/;
our @EXPORT_OK = qw/generate/;
our $VERSION = '0.001';

use constant TITLE => 'Account';

use HTML::Template::Compiled;
use Gruntmaster::Page::Common qw/header footer/;

my %templates = (
  en => <<'HTML',
<div id="result"></div>

<h1>Register</h1>
<form action="/action/register" method="POST" class="jsform">
Username:<br>
<input type="text" name="username" required><br>
Password:<br>
<input type="password" name="password" required><br>
Confirm password:<br>
<input type="password" name="confirm_password" required><br>
Full name:<br>
<input type="text" name="name" required><br>
Email:<br>
<input type="email" name="email" required><br>
Town:<br>
<input type="text" name="town" required><br>
University <i>(full name)</i>:<br>
<input type="text" name="university" required><br>
<input type="submit" value="Register">
</form>

<h1>Change password</h1>
<form action="/action/passwd" method="POST" class="jsform">
Old password:<br>
<input type="password" name="password" required><br>
New password:<br>
<input type="password" name="new_password" required><br>
Confirm new password:<br>
<input type="password" name="confirm_new_password" required><br>
<input type="submit" value="Change password">
</form>
HTML
);

$templates{$_}  = header($_, TITLE) . $templates{$_} for keys %templates;
$templates{$_} .= footer $_ for keys %templates;

sub generate{
  HTML::Template::Compiled->new(scalarref => \$templates{$_[1]})->output
}

1
