diff options
author | Daniel Friesel <derf@finalrewind.org> | 2023-01-22 11:34:53 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2023-01-22 11:34:53 +0100 |
commit | 59e9a24aa63d0209ea301b2c4aa71687e8295be6 (patch) | |
tree | c8ead7e0f04abd4ca4090c59d9c7897ba75134b9 /lib/Travelynx/Controller/Account.pm | |
parent | af82c46d576ac7d24801d1851ebcce1eb97390d5 (diff) |
move get_api_token to users model
Diffstat (limited to 'lib/Travelynx/Controller/Account.pm')
-rw-r--r-- | lib/Travelynx/Controller/Account.pm | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/Travelynx/Controller/Account.pm b/lib/Travelynx/Controller/Account.pm index 52850f7..2d9a1ce 100644 --- a/lib/Travelynx/Controller/Account.pm +++ b/lib/Travelynx/Controller/Account.pm @@ -388,10 +388,11 @@ sub verify { sub delete { my ($self) = @_; + my $uid = $self->current_user->{id}; if ( $self->validation->csrf_protect->has_error('csrf_token') ) { $self->render( 'account', - api_token => $self->get_api_token, + api_token => $self->users->get_api_token( uid => $uid ), invalid => 'csrf', ); return; @@ -407,15 +408,15 @@ sub delete { { $self->render( 'account', - api_token => $self->get_api_token, + api_token => $self->users->get_api_token( uid => $uid ), invalid => 'deletion password' ); return; } - $self->users->flag_deletion( uid => $self->current_user->{id} ); + $self->users->flag_deletion( uid => $uid ); } else { - $self->users->unflag_deletion( uid => $self->current_user->{id} ); + $self->users->unflag_deletion( uid => $uid ); } $self->redirect_to('account'); } @@ -950,9 +951,11 @@ sub confirm_mail { sub account { my ($self) = @_; + my $uid = $self->current_user->{id}; - $self->render( 'account', api_token => $self->get_api_token ); - $self->users->mark_seen( uid => $self->current_user->{id} ); + $self->render( 'account', + api_token => $self->users->get_api_token( uid => $uid ) ); + $self->users->mark_seen( uid => $uid ); } sub json_export { |