SBCL => 'l',
};
-use constant NOT_FOUND => [404, ['Content-Type' => 'text/plain'], ['Not found']];
+use constant NOT_FOUND => [404, ['X-Forever' => 1, 'Content-Type' => 'text/plain'], ['Not found']];
use constant FORBIDDEN => [401, ['Content-Type' => 'text/plain', 'WWW-Authenticate' => 'Basic realm="Gruntmaster 6000"'], ['Forbidden']];
sub development() { ($ENV{PLACK_ENV} // 'development') eq 'development' }
[200, \@headers, [development ? $js : JavaScript::Minifier::XS::minify $js]]
},
+ sub (/robots.txt) { NOT_FOUND },
+ sub (/favicon.ico) { NOT_FOUND },
+
sub (/src/:job) {
return NOT_FOUND if !job;
my $isowner = remote_user && remote_user->id eq job->rawowner;
sub (/ed/:contest) {
forbid contest->is_running;
- response ed => 'Editorial of ' . contest->name, db->problem_list(contest => $_{contest}, solution => 1);
+ my $pblist = db->problem_list(contest => $_{contest}, solution => 1);
+ response ed => 'Editorial of ' . contest->name, {%$pblist, editorial => contest->editorial};
},
sub (/login) {
Username: $_{username}
Password: <your new password>
Reset token: $token
+
+The token is valid for 24 hours.
EOF
my $email = Email::Simple->create(
header => [
my $user = db->user($_{username});
return reply 'No such user' unless $user;
my ($token, $exp) = split ':', $_{token};
+ return reply 'Reset token is expired' if time >= $exp;
return reply 'Bad reset token' unless $user->make_reset_hmac($exp) eq $token;
$user->set_passphrase($_{password});
reply 'Password reset successfully';