Fix commonmark error.

This commit is contained in:
James Cole
2021-08-02 20:30:26 +02:00
parent f7f296c674
commit e04a71738d
5 changed files with 30 additions and 34 deletions

View File

@@ -30,7 +30,6 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails; use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
use Illuminate\View\View; use Illuminate\View\View;
use Log; use Log;
@@ -93,15 +92,12 @@ class ForgotPasswordController extends Controller
// We will send the password reset link to this user. Once we have attempted // We will send the password reset link to this user. Once we have attempted
// to send the link, we will examine the response then see the message we // to send the link, we will examine the response then see the message we
// need to show to the user. Finally, we'll send out a proper response. // need to show to the user. Finally, we'll send out a proper response.
$response = $this->broker()->sendResetLink( $this->broker()->sendResetLink($request->only('email'));
$request->only('email')
);
if ($response === Password::RESET_LINK_SENT) { // always send the same response:
return back()->with('status', trans($response)); $response = trans('firefly.forgot_password_response');
}
return back()->withErrors(['email' => trans($response)]); return back()->with('status', trans($response));
} }
/** /**

View File

@@ -69,6 +69,7 @@ class RegisterController extends Controller
if ('eloquent' !== $loginProvider || 'web' !== $authGuard) { if ('eloquent' !== $loginProvider || 'web' !== $authGuard) {
throw new FireflyException('Using external identity provider. Cannot continue.'); throw new FireflyException('Using external identity provider. Cannot continue.');
} }
} }
/** /**
@@ -84,21 +85,19 @@ class RegisterController extends Controller
{ {
// is allowed to? // is allowed to?
$allowRegistration = true; $allowRegistration = true;
$loginProvider = config('firefly.login_provider');
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
$userCount = User::count(); $userCount = User::count();
if (true === $singleUserMode && $userCount > 0 && 'eloquent' === $loginProvider) { $guard = config('auth.defaults.guard');
if (true === $singleUserMode && $userCount > 0 && 'ldap' !== $guard) {
$allowRegistration = false; $allowRegistration = false;
} }
if ('eloquent' !== $loginProvider) { if ('ldap' === $guard) {
$allowRegistration = false; $allowRegistration = false;
} }
if (false === $allowRegistration) { if (false === $allowRegistration) {
$message = 'Registration is currently not available.'; throw new FireflyException('Registration is currently not available :(');
return prefixView('error', compact('message'));
} }
$this->validator($request->all())->validate(); $this->validator($request->all())->validate();
@@ -126,21 +125,21 @@ class RegisterController extends Controller
public function showRegistrationForm(Request $request) public function showRegistrationForm(Request $request)
{ {
$allowRegistration = true; $allowRegistration = true;
$loginProvider = config('firefly.login_provider');
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; $isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
$userCount = User::count(); $userCount = User::count();
$pageTitle = (string)trans('firefly.register_page_title'); $pageTitle = (string)trans('firefly.register_page_title');
$guard = config('auth.defaults.guard');
if (true === $isDemoSite) { if (true === $isDemoSite) {
$allowRegistration = false; $allowRegistration = false;
} }
if (true === $singleUserMode && $userCount > 0 && 'eloquent' === $loginProvider) { if (true === $singleUserMode && $userCount > 0 && 'ldap' !== $guard) {
$allowRegistration = false; $allowRegistration = false;
} }
if ('eloquent' !== $loginProvider) { if ('ldap' === $guard) {
$allowRegistration = false; $allowRegistration = false;
} }

View File

@@ -87,7 +87,6 @@ class ResetPasswordController extends Controller
return prefixView('error', compact('message')); return prefixView('error', compact('message'));
} }
$rules = [ $rules = [
'token' => 'required', 'token' => 'required',
'email' => 'required|email', 'email' => 'required|email',

View File

@@ -28,7 +28,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Support\Search\OperatorQuerySearch; use FireflyIII\Support\Search\OperatorQuerySearch;
use League\CommonMark\CommonMarkConverter; use League\CommonMark\CommonMarkConverter;
use League\CommonMark\Environment; use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\GithubFlavoredMarkdownExtension; use League\CommonMark\Extension\GithubFlavoredMarkdownExtension;
use Route; use Route;
use Twig\Extension\AbstractExtension; use Twig\Extension\AbstractExtension;
@@ -203,8 +203,10 @@ class General extends AbstractExtension
protected function markdown(): TwigFilter protected function markdown(): TwigFilter
{ {
return new TwigFilter( return new TwigFilter(
'markdown', 'markdown',
static function (string $text): string { static function (string $text): string {
$environment = Environment::createCommonMarkEnvironment(); $environment = Environment::createCommonMarkEnvironment();
$environment->addExtension(new GithubFlavoredMarkdownExtension()); $environment->addExtension(new GithubFlavoredMarkdownExtension());
@@ -355,7 +357,7 @@ class General extends AbstractExtension
/** /**
* @return TwigFunction * @return TwigFunction
* See reference nr. 43 * See reference nr. 43
*/ */
protected function getMetaField(): TwigFunction protected function getMetaField(): TwigFunction
{ {

26
composer.lock generated
View File

@@ -8017,21 +8017,21 @@
}, },
{ {
"name": "composer/xdebug-handler", "name": "composer/xdebug-handler",
"version": "2.0.1", "version": "2.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/xdebug-handler.git", "url": "https://github.com/composer/xdebug-handler.git",
"reference": "964adcdd3a28bf9ed5d9ac6450064e0d71ed7496" "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/xdebug-handler/zipball/964adcdd3a28bf9ed5d9ac6450064e0d71ed7496", "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/84674dd3a7575ba617f5a76d7e9e29a7d3891339",
"reference": "964adcdd3a28bf9ed5d9ac6450064e0d71ed7496", "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^5.3.2 || ^7.0 || ^8.0", "php": "^5.3.2 || ^7.0 || ^8.0",
"psr/log": "^1.0" "psr/log": "^1 || ^2 || ^3"
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "^0.12.55", "phpstan/phpstan": "^0.12.55",
@@ -8061,7 +8061,7 @@
"support": { "support": {
"irc": "irc://irc.freenode.org/composer", "irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/xdebug-handler/issues", "issues": "https://github.com/composer/xdebug-handler/issues",
"source": "https://github.com/composer/xdebug-handler/tree/2.0.1" "source": "https://github.com/composer/xdebug-handler/tree/2.0.2"
}, },
"funding": [ "funding": [
{ {
@@ -8077,7 +8077,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-05-05T19:37:51+00:00" "time": "2021-07-31T17:03:58+00:00"
}, },
{ {
"name": "doctrine/instantiator", "name": "doctrine/instantiator",
@@ -8484,16 +8484,16 @@
}, },
{ {
"name": "maximebf/debugbar", "name": "maximebf/debugbar",
"version": "v1.17.0", "version": "v1.17.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/maximebf/php-debugbar.git", "url": "https://github.com/maximebf/php-debugbar.git",
"reference": "4ef8e359d9fffbfbce26218ee36f196453a4dd7d" "reference": "0a3532556be0145603f8a9de23e76dc28eed7054"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/4ef8e359d9fffbfbce26218ee36f196453a4dd7d", "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/0a3532556be0145603f8a9de23e76dc28eed7054",
"reference": "4ef8e359d9fffbfbce26218ee36f196453a4dd7d", "reference": "0a3532556be0145603f8a9de23e76dc28eed7054",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -8543,9 +8543,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/maximebf/php-debugbar/issues", "issues": "https://github.com/maximebf/php-debugbar/issues",
"source": "https://github.com/maximebf/php-debugbar/tree/v1.17.0" "source": "https://github.com/maximebf/php-debugbar/tree/v1.17.1"
}, },
"time": "2021-07-27T05:47:57+00:00" "time": "2021-08-01T09:19:02+00:00"
}, },
{ {
"name": "mockery/mockery", "name": "mockery/mockery",