Add info about max bio length, make names length customizable

Signed-off-by: Marcin Mikołajczak <me@m4sk.in>
This commit is contained in:
Marcin Mikołajczak 2018-06-08 22:29:57 -07:00
parent eed7ab5fee
commit 994aed0752
4 changed files with 29 additions and 6 deletions

View file

@ -54,7 +54,7 @@ class RegisterController extends Controller
$rules = [ $rules = [
'name' => 'required|string|max:255', 'name' => 'required|string|max' . config('pixelfed.max_name_length'),
'username' => 'required|alpha_dash|min:2|max:15|unique:users', 'username' => 'required|alpha_dash|min:2|max:15|unique:users',
'email' => 'required|string|email|max:255|unique:users', 'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed', 'password' => 'required|string|min:6|confirmed',

View file

@ -21,8 +21,8 @@ class SettingsController extends Controller
public function homeUpdate(Request $request) public function homeUpdate(Request $request)
{ {
$this->validate($request, [ $this->validate($request, [
'name' => 'required|string|max:30', 'name' => 'required|string|max:' . config('pixelfed.max_name_length'),
'bio' => 'nullable|string|max:125' 'bio' => 'nullable|string|max:' . config('pixelfed.max_bio_length')
]); ]);
$changes = false; $changes = false;

View file

@ -97,4 +97,24 @@ return [
*/ */
'max_caption_length' => env('MAX_CAPTION_LENGTH', 150), 'max_caption_length' => env('MAX_CAPTION_LENGTH', 150),
/*
|--------------------------------------------------------------------------
| Bio length limit
|--------------------------------------------------------------------------
|
| Change the bio length limit for user profiles.
|
*/
'max_bio_length' => env('MAX_BIO_LENGTH', 125),
/*
|--------------------------------------------------------------------------
| User name length limit
|--------------------------------------------------------------------------
|
| Change the length limit for user names.
|
*/
'max_name_length' => env('MAX_NAME_LENGTH', 30),
]; ];

View file

@ -24,6 +24,9 @@
<label class="col-sm-3 col-form-label font-weight-bold text-right">Bio</label> <label class="col-sm-3 col-form-label font-weight-bold text-right">Bio</label>
<div class="col-sm-9"> <div class="col-sm-9">
<textarea class="form-control" name="bio" placeholder="Add a bio here" rows="2">{{Auth::user()->profile->bio}}</textarea> <textarea class="form-control" name="bio" placeholder="Add a bio here" rows="2">{{Auth::user()->profile->bio}}</textarea>
<small class="form-text text-muted">
Max length: {{config('pixelfed.max_bio_length')}} characters.
</small>
</div> </div>
</div> </div>
<div class="pt-5"> <div class="pt-5">