disable import and checkin API endpoints in production mode

This commit is contained in:
Daniel Friesel 2019-12-17 20:46:17 +01:00
parent f895d34f31
commit 69f961a23c
3 changed files with 28 additions and 0 deletions

View file

@ -181,6 +181,17 @@ sub travel_v1 {
return; return;
} }
if ( $self->app->mode ne 'development' ) {
$self->render(
json => {
success => \0,
error =>
'This feature is incomplete and only available in development mode',
},
);
return;
}
my $api_token = $payload->{token} // ''; my $api_token = $payload->{token} // '';
if ( $api_token !~ qr{ ^ (?<id> \d+ ) - (?<token> .* ) $ }x ) { if ( $api_token !~ qr{ ^ (?<id> \d+ ) - (?<token> .* ) $ }x ) {
@ -361,6 +372,17 @@ sub import_v1 {
return; return;
} }
if ( $self->app->mode ne 'development' ) {
$self->render(
json => {
success => \0,
error =>
'This feature is incomplete and only available in development mode',
},
);
return;
}
my $api_token = $payload->{token} // ''; my $api_token = $payload->{token} // '';
if ( $api_token !~ qr{ ^ (?<id> \d+ ) - (?<token> .* ) $ }x ) { if ( $api_token !~ qr{ ^ (?<id> \d+ ) - (?<token> .* ) $ }x ) {

View file

@ -170,6 +170,7 @@
%= end %= end
</td> </td>
</tr>--> </tr>-->
% if (app->mode eq 'development') {
<tr> <tr>
<th scope="row">Travel</th> <th scope="row">Travel</th>
<td> <td>
@ -216,6 +217,7 @@
%= end %= end
</td> </td>
</tr> </tr>
% }
</table> </table>
</div> </div>
</div> </div>

View file

@ -65,6 +65,8 @@
</div> </div>
</div> </div>
% if (app->mode eq 'development') {
<h2>Travel</h2> <h2>Travel</h2>
<div class="row"> <div class="row">
<div class="col s12"> <div class="col s12">
@ -188,3 +190,5 @@
</p> </p>
</div> </div>
</div> </div>
% }