Make this variable stuff more consistent, not sure why I did this
This commit is contained in:
parent
8fb64fde64
commit
ee5385290a
|
@ -44,17 +44,13 @@ sub login($self) {
|
|||
$self->stash(status => 400)
|
||||
}
|
||||
else {
|
||||
my ($email, $password);
|
||||
|
||||
$email = $self->param('email' );
|
||||
$password = $self->param('password');
|
||||
my $email = $self->param('email' );
|
||||
my $password = $self->param('password');
|
||||
|
||||
if ($self->moderator->check($email, $password)) {
|
||||
my ($mod_id, $mod_name, $admin_status);
|
||||
|
||||
$mod_id = $self->moderator->get_id($email);
|
||||
$mod_name = $self->moderator->get_name($mod_id);
|
||||
$admin_status = $self->moderator->admin_status($mod_id);
|
||||
my $mod_id = $self->moderator->get_id($email);
|
||||
my $mod_name = $self->moderator->get_name($mod_id);
|
||||
my $admin_status = $self->moderator->admin_status($mod_id);
|
||||
|
||||
$self->session(
|
||||
mod_id => $mod_id,
|
||||
|
@ -162,11 +158,9 @@ sub create($self) {
|
|||
$self->stash(status => 400)
|
||||
}
|
||||
else {
|
||||
my ($name, $email, $password);
|
||||
|
||||
$name = $self->param('name' );
|
||||
$email = $self->param('email' );
|
||||
$password = $self->param('password');
|
||||
my $name = $self->param('name' );
|
||||
my $email = $self->param('email' );
|
||||
my $password = $self->param('password');
|
||||
|
||||
$self->moderator->create($name, $email, $password);
|
||||
$self->stash(info => "Created moderator account for $name 🧑🏭");
|
||||
|
@ -189,10 +183,8 @@ sub admin_reset($self) {
|
|||
$self->stash(status => 400)
|
||||
}
|
||||
else {
|
||||
my ($email, $password);
|
||||
|
||||
$email = $self->param('email' );
|
||||
$password = $self->param('password');
|
||||
my $email = $self->param('email' );
|
||||
my $password = $self->param('password');
|
||||
|
||||
$self->moderator->admin_reset($email, $password);
|
||||
$self->stash(info => "Reset password for $email 🔐");
|
||||
|
@ -214,10 +206,8 @@ sub mod_reset($self) {
|
|||
$self->stash(status => 400)
|
||||
}
|
||||
else {
|
||||
my ($password, $mod_id);
|
||||
|
||||
$password = $self->param('password');
|
||||
$mod_id = $self->session->{'mod_id'};
|
||||
my $password = $self->param('password');
|
||||
my $mod_id = $self->session->{'mod_id'};
|
||||
|
||||
$self->moderator->mod_reset($mod_id, $password);
|
||||
$self->flash(info => "Password has been reset 🔐");
|
||||
|
|
|
@ -20,8 +20,6 @@ sub create($self) {
|
|||
$v = $self->validation if $self->req->method eq 'POST';
|
||||
|
||||
if ($v && $v->has_data) {
|
||||
my ($remark_author, $remark_body, $bump_thread);
|
||||
|
||||
$v->required('author')->size(1, 63);
|
||||
$v->required('body' )->size(2, 4000);
|
||||
$v->optional('bump' );
|
||||
|
@ -30,9 +28,9 @@ sub create($self) {
|
|||
$self->stash(status => 400)
|
||||
}
|
||||
else {
|
||||
$remark_author = $v->param('author');
|
||||
$remark_body = $v->param('body' );
|
||||
$bump_thread = $v->param('bump' );
|
||||
my $remark_author = $v->param('author');
|
||||
my $remark_body = $v->param('body' );
|
||||
my $bump_thread = $v->param('bump' );
|
||||
|
||||
$self->remark->create(
|
||||
$thread_id,
|
||||
|
|
|
@ -10,8 +10,6 @@ sub create($self) {
|
|||
$v = $self->validation if $self->req->method eq 'POST';
|
||||
|
||||
if ($v && $v->has_data) {
|
||||
my ($thread_author, $thread_title, $thread_body);
|
||||
|
||||
$v->required('author')->size(1, 63);
|
||||
$v->required('title' )->size(1, 127);
|
||||
$v->required('body' )->size(2, 4000);
|
||||
|
@ -20,9 +18,9 @@ sub create($self) {
|
|||
$self->stash(status => 400)
|
||||
}
|
||||
else {
|
||||
$thread_author = $v->param('author');
|
||||
$thread_title = $v->param('title' );
|
||||
$thread_body = $v->param('body' );
|
||||
my $thread_author = $v->param('author');
|
||||
my $thread_title = $v->param('title' );
|
||||
my $thread_body = $v->param('body' );
|
||||
|
||||
my $new_thread_id = $self->thread->create(
|
||||
$thread_author,
|
||||
|
@ -42,14 +40,12 @@ sub create($self) {
|
|||
}
|
||||
|
||||
sub by_id($self) {
|
||||
my ($thread_id, $thread, $base_path, $this_page, $last_page, $remarks);
|
||||
|
||||
$thread_id = $self->param('thread_id');
|
||||
$thread = $self->thread->by_id($thread_id);
|
||||
$base_path = $self->match->path_for(thread_page => undef)->{'path'};
|
||||
$this_page = $self->param('thread_page');
|
||||
$last_page = $self->remark->last_page_for($thread_id);
|
||||
$remarks = $self->remark->by_page_for($thread_id, $this_page);
|
||||
my $thread_id = $self->param('thread_id');
|
||||
my $thread = $self->thread->by_id($thread_id);
|
||||
my $base_path = $self->match->path_for(thread_page => undef)->{'path'};
|
||||
my $this_page = $self->param('thread_page');
|
||||
my $last_page = $self->remark->last_page_for($thread_id);
|
||||
my $remarks = $self->remark->by_page_for($thread_id, $this_page);
|
||||
|
||||
$self->stash(
|
||||
thread => $thread,
|
||||
|
|
Loading…
Reference in a new issue