From a34a67b2f9127440860eb7228b295c17e592d6c8 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 13 Sep 2021 20:55:11 +0200 Subject: Add account add / delete CLI for sites with web registration disabled --- lib/Travelynx/Model/Users.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/Travelynx/Model') 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; -- cgit v1.2.3