diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php
index 258cc06de03..29e3b58c512 100644
--- a/app/Support/Twig/General.php
+++ b/app/Support/Twig/General.php
@@ -49,6 +49,7 @@ public function getFilters(): array
$this->mimeIcon(),
$this->markdown(),
$this->floatval(),
+ $this->phpHostName(),
];
}
@@ -91,6 +92,24 @@ static function (?Account $account): string {
);
}
+ /**
+ * Show URL host name
+ *
+ * @return TwigFilter
+ */
+ protected function phpHostName(): TwigFilter
+ {
+ return new TwigFilter(
+ 'phphost',
+ static function (string $string): string {
+ $proto = (string)parse_url($string, PHP_URL_SCHEME);
+ $host = (string)parse_url($string, PHP_URL_HOST);
+
+ return e(sprintf('%s://%s', $proto, $host));
+ }
+ );
+ }
+
/**
* Used to convert 1024 to 1kb etc.
*
diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php
index 519166247ef..0abcac273d5 100644
--- a/resources/lang/en_US/firefly.php
+++ b/resources/lang/en_US/firefly.php
@@ -232,7 +232,9 @@
// API access
'authorization_request' => 'Firefly III v:version Authorization Request',
- 'authorization_request_intro' => ':client is requesting permission to access your financial administration. Would you like to authorize :client to access these records?',
+ 'authorization_request_intro' => 'Application ":client" is requesting permission to access your financial administration. Would you like to authorize :client to access these records?',
+ 'authorization_request_site' => 'You will be redirected to :url
which will then be able to access your Firefly III data.',
+ 'authorization_request_invalid' => 'This access request is invalid. Please never follow this link again.',
'scopes_will_be_able' => 'This application will be able to:',
'button_authorize' => 'Authorize',
'none_in_select_list' => '(none)',
diff --git a/resources/views/vendor/passport/authorize.twig b/resources/views/vendor/passport/authorize.twig
index 53387561dde..78407c7cf14 100644
--- a/resources/views/vendor/passport/authorize.twig
+++ b/resources/views/vendor/passport/authorize.twig
@@ -56,10 +56,21 @@
{{ trans('firefly.authorization_request', {version: config('firefly.version')}) }}
{{ trans('firefly.authorization_request_intro', {client: client.name|escape})|raw }}
++ {{ trans('firefly.authorization_request_site', {url: client.redirect|phphost})|raw }} +
+ {% endif %} + + {% if client.user.id != user.id %} ++ {{ 'authorization_request_invalid'|_ }} + +
+ {% endif %} {% if scopes|length > 0 %}