Add method for creating moderator
This commit is contained in:
parent
d9a18ffa44
commit
6be8cc43a9
|
@ -32,6 +32,7 @@ Run the tests locally (against development environment):
|
|||
|
||||
## TODOs
|
||||
|
||||
1. Increment last_login_date when loggin in!!
|
||||
1. Actions for creating moderators and resetting passwords
|
||||
1. CSS
|
||||
1. "All new posts flagged" mode (require approval for new posts)
|
||||
|
|
|
@ -4,6 +4,18 @@ use Mojo::Base -base, -signatures;
|
|||
|
||||
has [qw{pg authenticator}];
|
||||
|
||||
sub create($self, $name, $email, $password) {
|
||||
my $password_hash = $self->authenticator->hash_password($password);
|
||||
|
||||
$self->pg->db->query(<<~'END_SQL', $name, $email, $password_hash);
|
||||
INSERT INTO moderators
|
||||
(moderator_name,
|
||||
email_addr,
|
||||
password_hash)
|
||||
VALUES (?, ?, ?);
|
||||
END_SQL
|
||||
}
|
||||
|
||||
sub check($self, $email, $password) {
|
||||
my $moderator =
|
||||
$self->pg->db->query(<<~'END_SQL', $email)->hash;
|
||||
|
|
Loading…
Reference in New Issue
Block a user