diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index 6fd2ee2..6ab89fe 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -208,17 +208,6 @@ sub startup { ); } ); - $self->attr( - set_status_query => sub { - my ($self) = @_; - - return $self->app->dbh->prepare( - qq{ - update users set status = ? where id = ?; - } - ); - } - ); $self->attr( mark_for_deletion_query => sub { my ($self) = @_; @@ -447,19 +436,6 @@ qq{select * from pending_mails where email = ? and num_tries > 1;} ); } ); - $self->attr( - get_token_query => sub { - my ($self) = @_; - - return $self->app->dbh->prepare( - qq{ - select - name, status, token - from users where id = ? - } - ); - } - ); $self->attr( get_stationid_by_ds100_query => sub { my ($self) = @_; @@ -1019,11 +995,14 @@ qq{select * from pending_mails where email = ? and num_tries > 1;} 'get_user_token' => sub { my ( $self, $uid ) = @_; - my $query = $self->app->get_token_query; - $query->execute($uid); - my $rows = $query->fetchall_arrayref; - if ( @{$rows} ) { - return @{ $rows->[0] }; + my $res = $self->pg->db->select( + 'users', + [ 'name', 'status', 'token' ], + { id => $uid } + ); + + if ( my $ret = $res->array ) { + return @{$ret}; } return; } diff --git a/lib/Travelynx/Controller/Account.pm b/lib/Travelynx/Controller/Account.pm index 9e8c1fb..8626dc8 100644 --- a/lib/Travelynx/Controller/Account.pm +++ b/lib/Travelynx/Controller/Account.pm @@ -171,7 +171,7 @@ sub verify { $self->render( 'register', invalid => 'token' ); return; } - $self->app->set_status_query->execute( 1, $id ); + $self->app->pg->db->update( 'users', { status => 1 }, { id => $id } ); $self->render( 'login', from => 'verification' ); }