diff --git a/.env.example b/.env.example index 9a28c9f373..84b28a75c2 100755 --- a/.env.example +++ b/.env.example @@ -42,6 +42,7 @@ SHOW_INCOMPLETE_TRANSLATIONS=false CACHE_PREFIX=firefly EXCHANGE_RATE_SERVICE=fixerio +PASSWORD_SERVICE=false GOOGLE_MAPS_API_KEY= ANALYTICS_ID= diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 7f7816b64d..6d2822d398 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -17,6 +17,7 @@ use Config; use FireflyConfig; use FireflyIII\Events\RegisteredUser; use FireflyIII\Http\Controllers\Controller; +use FireflyIII\Http\Requests\UserRegistrationRequest; use FireflyIII\User; use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Http\Request; @@ -56,7 +57,7 @@ class RegisterController extends Controller * * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View */ - public function register(Request $request) + public function register(UserRegistrationRequest $request) { // is allowed to? $singleUserMode = FireflyConfig::get('single_user_mode', Config::get('firefly.configuration.single_user_mode'))->data; diff --git a/app/Http/Requests/ProfileFormRequest.php b/app/Http/Requests/ProfileFormRequest.php index fe1ac7bf93..3310897272 100644 --- a/app/Http/Requests/ProfileFormRequest.php +++ b/app/Http/Requests/ProfileFormRequest.php @@ -37,7 +37,7 @@ class ProfileFormRequest extends Request { return [ 'current_password' => 'required', - 'new_password' => 'required|confirmed', + 'new_password' => 'required|confirmed|secure_password', 'new_password_confirmation' => 'required', ]; } diff --git a/app/Http/Requests/UserRegistrationRequest.php b/app/Http/Requests/UserRegistrationRequest.php new file mode 100644 index 0000000000..db2f7bda8c --- /dev/null +++ b/app/Http/Requests/UserRegistrationRequest.php @@ -0,0 +1,53 @@ + $this->string('email'), + 'password' => $this->string('password'), + ]; + } + + /** + * @return array + */ + public function rules() + { + return [ + 'email' => 'email|required', + 'password' => 'confirmed|secure_password', + + ]; + } +} diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php index 0e88f0dc8d..d6918d0d57 100644 --- a/app/Providers/FireflyServiceProvider.php +++ b/app/Providers/FireflyServiceProvider.php @@ -39,6 +39,8 @@ use FireflyIII\Support\Amount; use FireflyIII\Support\ExpandedForm; use FireflyIII\Support\FireflyConfig; use FireflyIII\Support\Navigation; +use FireflyIII\Support\Password\PwndVerifier; +use FireflyIII\Support\Password\Verifier; use FireflyIII\Support\Preferences; use FireflyIII\Support\Steam; use FireflyIII\Support\Twig\AmountFormat; @@ -147,6 +149,9 @@ class FireflyServiceProvider extends ServiceProvider $this->app->bind(FiscalHelperInterface::class, FiscalHelper::class); $this->app->bind(BalanceReportHelperInterface::class, BalanceReportHelper::class); $this->app->bind(BudgetReportHelperInterface::class, BudgetReportHelper::class); + + // password verifier thing + $this->app->bind(Verifier::class, PwndVerifier::class); } } diff --git a/app/Support/Password/PwndVerifier.php b/app/Support/Password/PwndVerifier.php new file mode 100644 index 0000000000..d991d9f38e --- /dev/null +++ b/app/Support/Password/PwndVerifier.php @@ -0,0 +1,51 @@ + 'Firefly III v' . config('firefly.version'), 'timeout' => 2]; + + try { + $result = Requests::get($uri, ['originalPasswordIsAHash' => 'true'], $opt); + } catch (Requests_Exception $e) { + return true; + } + Log::debug(sprintf('Status code returned is %d', $result->status_code)); + if ($result->status_code === 404) { + return true; + } + + return false; + } +} \ No newline at end of file diff --git a/app/Support/Password/Verifier.php b/app/Support/Password/Verifier.php new file mode 100644 index 0000000000..1f8603ead2 --- /dev/null +++ b/app/Support/Password/Verifier.php @@ -0,0 +1,29 @@ +validPassword($value); + } + /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @param $attribute diff --git a/resources/lang/en_US/validation.php b/resources/lang/en_US/validation.php index ea21edefe4..23031202f9 100644 --- a/resources/lang/en_US/validation.php +++ b/resources/lang/en_US/validation.php @@ -88,4 +88,5 @@ return [ 'in_array' => 'The :attribute field does not exist in :other.', 'present' => 'The :attribute field must be present.', 'amount_zero' => 'The total amount cannot be zero', + 'secure_password' => 'This is not a secure password. Please try again. For more information, visit https://goo.gl/NCh2tN', ]; diff --git a/resources/views/import/finished.twig b/resources/views/import/finished.twig deleted file mode 100644 index 9f981e3517..0000000000 --- a/resources/views/import/finished.twig +++ /dev/null @@ -1,38 +0,0 @@ -{% extends "./layout/default" %} - -{% block breadcrumbs %} - {{ Breadcrumbs.renderIfExists }} -{% endblock %} -{% block content %} -
-
-
-
-

{{ 'import_finished'|_ }}

-
-
-

- {{ 'import_finished_intro'|_ }} -

- {% if tagId > 0 %} -

- {{ trans('firefly.import_finished_text_with_link', {tag: tagId})|raw }} -

- {% else %} -

- {{ 'import_finished_text_without_link'|_ }} -

- {% endif %} - -

- {{ 'import_share_configuration'|_ }} -

-
-
-
-
-{% endblock %} -{% block scripts %} -{% endblock %} -{% block styles %} -{% endblock %} diff --git a/resources/views/import/status.twig b/resources/views/import/status.twig deleted file mode 100644 index f1a8bcd5c6..0000000000 --- a/resources/views/import/status.twig +++ /dev/null @@ -1,157 +0,0 @@ -{% extends "./layout/default" %} - -{% block breadcrumbs %} - {{ Breadcrumbs.renderIfExists }} -{% endblock %} -{% block content %} - - {# Initial display. Will refresh (and disappear almost immediately. #} - -
-
-
-
-

{{ 'import_status_wait_title'|_ }}

-
-
-

- {{ 'import_status_wait_text'|_ }} -

-
-
-
-
- - {# Fatal error display. Will be shown (duh) when something goes horribly wrong. #} - - - {# Box for when the job is ready to start #} - - - {# Box for when the job is running! #} - - - {# displays the finished status of the import. #} - - - {# box to show error information. #} - - -{% endblock %} -{% block scripts %} - - -{% endblock %} -{% block styles %} -{% endblock %}