From 09479c02ca08276a8d7ddeda83cf6c525e0cf7da Mon Sep 17 00:00:00 2001 From: delthas Date: Mon, 31 Aug 2020 22:28:19 +0200 Subject: [PATCH] Make the minimum user password length configurable Previously, all passwords had to be at least 12 characters long. Some users use a slightly shorter password, so some instances could wish to reduce the password length limit to a slightly lesser value. This makes the minimum password length configurable in the .env file, with the MIN_PASSWORD_LENGTH variable, that defaults to 12 to keep the previous behaviour by default. --- app/Http/Controllers/Auth/RegisterController.php | 2 +- config/pixelfed.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 02dbee42a..0a30c0705 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -115,7 +115,7 @@ class RegisterController extends Controller 'name' => 'nullable|string|max:'.config('pixelfed.max_name_length'), 'username' => $usernameRules, 'email' => $emailRules, - 'password' => 'required|string|min:12|confirmed', + 'password' => 'required|string|min:'.config('pixelfed.min_password_length').'|confirmed', ]; return Validator::make($data, $rules); diff --git a/config/pixelfed.php b/config/pixelfed.php index 7504c9493..cf2935b3e 100644 --- a/config/pixelfed.php +++ b/config/pixelfed.php @@ -119,6 +119,16 @@ return [ */ 'max_name_length' => env('MAX_NAME_LENGTH', 30), + /* + |-------------------------------------------------------------------------- + | Password minimum length limit + |-------------------------------------------------------------------------- + | + | Change the minimum length limit for user passwords. + | + */ + 'min_password_length' => env('MIN_PASSWORD_LENGTH', 12), + /* |-------------------------------------------------------------------------- | Album size limit