summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Model
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-09-13 20:55:11 +0200
committerDaniel Friesel <derf@finalrewind.org>2021-09-13 20:55:11 +0200
commita34a67b2f9127440860eb7228b295c17e592d6c8 (patch)
tree2570042bc6a4dfde92244dffdb11839f8b822e2b /lib/Travelynx/Model
parent85fcf63dd843e928a9a3149568682aa89795a1c9 (diff)
Add account add / delete CLI for sites with web registration disabled
Diffstat (limited to 'lib/Travelynx/Model')
-rw-r--r--lib/Travelynx/Model/Users.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Travelynx/Model/Users.pm b/lib/Travelynx/Model/Users.pm
index 535b938..1371b8a 100644
--- a/lib/Travelynx/Model/Users.pm
+++ b/lib/Travelynx/Model/Users.pm
@@ -34,7 +34,11 @@ sub verify_registration_token {
my $token = $opt{token};
my $db = $opt{db} // $self->{pg}->db;
- my $tx = $db->begin;
+ my $tx;
+
+ if ( not $opt{in_transaction} ) {
+ $tx = $db->begin;
+ }
my $res = $db->select(
'pending_registrations',
@@ -48,7 +52,9 @@ sub verify_registration_token {
if ( $res->hash->{count} ) {
$db->update( 'users', { status => 1 }, { id => $uid } );
$db->delete( 'pending_registrations', { user_id => $uid } );
- $tx->commit;
+ if ( not $opt{in_transaction} ) {
+ $tx->commit;
+ }
return 1;
}
return;