diff --git a/README.md b/README.md index 9fb8ff5..6283a75 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,6 @@ Run the tests locally (against development environment): ### (Lord knows there's TODOs I could be working on...) 1. RSS feed!! -1. Log user out if locked out? Will need to check `lock_status()` beyond just logging in 1. Support at least some Markdown, specifically the code blocks 1. Implement tripcodes (moving this down in priority due to complexity...) 1. Return a text response instead of HTML if a `.txt` extension [is diff --git a/lib/PostText.pm b/lib/PostText.pm index d76dab6..36e023c 100644 --- a/lib/PostText.pm +++ b/lib/PostText.pm @@ -52,7 +52,7 @@ sub startup($self) { $self->helper(is_mod => sub ($c) { if (my $mod_id = $c->session->{'mod_id'}) { - return 1 if $mod_id =~ /\d+/ + return 1 unless $c->moderator->lock_status($mod_id) } return undef; diff --git a/lib/PostText/Model/Moderator.pm b/lib/PostText/Model/Moderator.pm index 527ce43..2c8597b 100644 --- a/lib/PostText/Model/Moderator.pm +++ b/lib/PostText/Model/Moderator.pm @@ -45,6 +45,14 @@ sub lock_out($self, $mod_id) { END_SQL } +sub unlock($self, $mod_id) { + $self->pg->db->query(<<~'END_SQL', $mod_id) + UPDATE moderators + SET lock_status = FALSE + WHERE moderator_id = ?; + END_SQL +} + sub get_id($self, $email) { $self->pg->db->query(<<~'END_SQL', $email)->hash->{'moderator_id'} SELECT moderator_id