summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Controller/Account.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-04-22 12:11:22 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-04-22 12:11:22 +0200
commit2aece368035ab71a58f719f7ec526d566839980b (patch)
tree05d7d94e0b33b9891960bc32110c5d705cac6c38 /lib/Travelynx/Controller/Account.pm
parent4ed24c55653dafbac3053f57d6d3b094d4ad7fb5 (diff)
Use Mojo::Pg for all remaining Controller and Helper logic
Diffstat (limited to 'lib/Travelynx/Controller/Account.pm')
-rw-r--r--lib/Travelynx/Controller/Account.pm12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Travelynx/Controller/Account.pm b/lib/Travelynx/Controller/Account.pm
index 7753493..0037e16 100644
--- a/lib/Travelynx/Controller/Account.pm
+++ b/lib/Travelynx/Controller/Account.pm
@@ -114,10 +114,11 @@ sub register {
return;
}
- my $token = make_token();
- my $pw_hash = hash_password($password);
- $self->app->dbh->begin_work;
- my $user_id = $self->add_user( $user, $email, $token, $pw_hash );
+ my $token = make_token();
+ my $pw_hash = hash_password($password);
+ my $db = $self->pg->db;
+ my $tx = $db->begin;
+ my $user_id = $self->add_user( $db, $user, $email, $token, $pw_hash );
my $reg_url = $self->url_for('reg')->to_abs->scheme('https');
my $imprint_url = $self->url_for('impressum')->to_abs->scheme('https');
@@ -143,11 +144,10 @@ sub register {
my $success
= $self->sendmail->custom( $email, 'Registrierung bei travelynx', $body );
if ($success) {
- $self->app->dbh->commit;
+ $tx->commit;
$self->render( 'login', from => 'register' );
}
else {
- $self->app->dbh->rollback;
$self->render( 'register', invalid => 'sendmail' );
}
}