mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
fix: prevent the demo user from changing the slack URL
This commit is contained in:
@@ -133,6 +133,13 @@ class PreferencesController extends Controller
|
|||||||
$frontPageAccounts = $accountIds;
|
$frontPageAccounts = $accountIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for the demo user, the slackUrl is automatically emptied.
|
||||||
|
// this isn't really secure but it means that the demo site has a semi-secret
|
||||||
|
// slackUrl.
|
||||||
|
if (auth()->user()->hasRole('demo')) {
|
||||||
|
$slackUrl = '';
|
||||||
|
}
|
||||||
|
|
||||||
return view(
|
return view(
|
||||||
'preferences.index',
|
'preferences.index',
|
||||||
compact(
|
compact(
|
||||||
@@ -198,12 +205,14 @@ class PreferencesController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
// slack URL:
|
// slack URL:
|
||||||
$url = (string)$request->get('slackUrl');
|
if (!auth()->user()->hasRole('demo')) {
|
||||||
if (str_starts_with($url, 'https://hooks.slack.com/services/')) {
|
$url = (string)$request->get('slackUrl');
|
||||||
app('preferences')->set('slack_webhook_url', $url);
|
if (str_starts_with($url, 'https://hooks.slack.com/services/')) {
|
||||||
}
|
app('preferences')->set('slack_webhook_url', $url);
|
||||||
if ('' === $url) {
|
}
|
||||||
app('preferences')->delete('slack_webhook_url');
|
if ('' === $url) {
|
||||||
|
app('preferences')->delete('slack_webhook_url');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// custom fiscal year
|
// custom fiscal year
|
||||||
|
Reference in New Issue
Block a user