get '/reset/:token' => sub {
return template 'passreset' => {
my $input_hash {
token => params->{token}
}
} # end of return
# compare against stored tokens
my ($matched_user_id) = User->lookup_tokens($input_hash->{token});
if ($user_id < 1) { # does not match
halt("Unauthorized");
}
# token matches that of user no 349.
session mathced_user_id => $matched_user_id;
};
post '/reset/:token' => sub {
my $matched_userid;
if (! (defined session 'matched_user_id')) {
# not supposed to be here
redirect "/";
} else {
$matched_userid = session 'matched_user_id';
}
my $input_hash = {
Psw1 => param('password1'),
Psw2 => param('password2'),
};
# make sure passwords match eachother
# update password for user $matched_userid;
};