mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* API transport fix parsing parse templates after parsing user options, not before * API transport tests * fix style and lint * remove accidental item * fix more type issues
30 lines
1.0 KiB
PHP
30 lines
1.0 KiB
PHP
<?php
|
|
|
|
// handle OAuth requests
|
|
$request = request(); // grab the Request object
|
|
|
|
if ($request->has('oauthtransport')) {
|
|
// make sure transport is safe
|
|
$validator = Validator::make($request->all(), ['oauthtransport' => 'required|alpha']);
|
|
|
|
if ($validator->passes()) {
|
|
$transport_name = $request->get('oauthtransport');
|
|
$class = \LibreNMS\Alert\Transport::getClass($transport_name);
|
|
if (class_exists($class)) {
|
|
$transport = app($class);
|
|
if ($transport->handleOauth($request)) {
|
|
flash()->addSuccess("$transport_name added successfully.");
|
|
} else {
|
|
flash()->addError("$transport_name was not added. Check the log for details.");
|
|
}
|
|
}
|
|
}
|
|
|
|
// remove get variables otherwise things will get double added
|
|
echo '<script>window.history.replaceState(null, null, window.location.pathname);</script>';
|
|
}
|
|
unset($request);
|
|
|
|
// print alert transports
|
|
require_once 'includes/html/print-alert-transports.php';
|