diff options
Diffstat (limited to 'lib/Travelynx/Controller/Account.pm')
-rw-r--r-- | lib/Travelynx/Controller/Account.pm | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/Travelynx/Controller/Account.pm b/lib/Travelynx/Controller/Account.pm index 8d5b21f..75b8f02 100644 --- a/lib/Travelynx/Controller/Account.pm +++ b/lib/Travelynx/Controller/Account.pm @@ -230,6 +230,31 @@ sub privacy { } } +sub webhook { + my ($self) = @_; + + my $hook = $self->get_webhook; + + if ( $self->param('action') and $self->param('action') eq 'save' ) { + $hook->{url} = $self->param('url'); + $hook->{token} = $self->param('token'); + $hook->{enabled} = $self->param('enabled') // 0; + $self->set_webhook( + url => $hook->{url}, + token => $hook->{token}, + enabled => $hook->{enabled} + ); + $hook = $self->get_webhook; + } + else { + $self->param( url => $hook->{url} ); + $self->param( token => $hook->{token} ); + $self->param( enabled => $hook->{enabled} ); + } + + $self->render( 'webhooks', hook => $hook ); +} + sub change_mail { my ($self) = @_; |