Update settings, set maxlength on name and bio inputs. Fixes #4248

This commit is contained in:
Daniel Supernault 2023-03-25 04:35:31 -06:00
parent 994668fd98
commit 558700fc0a
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 11 additions and 4 deletions

View file

@ -22,7 +22,6 @@ use App\Services\PronounService;
trait HomeSettings trait HomeSettings
{ {
public function home() public function home()
{ {
$id = Auth::user()->profile->id; $id = Auth::user()->profile->id;
@ -41,7 +40,7 @@ trait HomeSettings
public function homeUpdate(Request $request) public function homeUpdate(Request $request)
{ {
$this->validate($request, [ $this->validate($request, [
'name' => 'required|string|max:'.config('pixelfed.max_name_length'), 'name' => 'nullable|string|max:'.config('pixelfed.max_name_length'),
'bio' => 'nullable|string|max:'.config('pixelfed.max_bio_length'), 'bio' => 'nullable|string|max:'.config('pixelfed.max_bio_length'),
'website' => 'nullable|url', 'website' => 'nullable|url',
'language' => 'nullable|string|min:2|max:5', 'language' => 'nullable|string|min:2|max:5',

View file

@ -39,7 +39,7 @@
<div class="form-group row"> <div class="form-group row">
<label for="name" class="col-sm-3 col-form-label font-weight-bold">Name</label> <label for="name" class="col-sm-3 col-form-label font-weight-bold">Name</label>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control" id="name" name="name" placeholder="Your Name" value="{{Auth::user()->profile->name}}" v-pre> <input type="text" class="form-control" id="name" name="name" placeholder="Your Name" maxlength="30" value="{{Auth::user()->profile->name}}" v-pre>
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
@ -51,7 +51,15 @@
<div class="form-group row"> <div class="form-group row">
<label for="bio" class="col-sm-3 col-form-label font-weight-bold">Bio</label> <label for="bio" class="col-sm-3 col-form-label font-weight-bold">Bio</label>
<div class="col-sm-9"> <div class="col-sm-9">
<textarea class="form-control" id="bio" name="bio" placeholder="Add a bio here" rows="2" data-max-length="{{config('pixelfed.max_bio_length')}}" v-pre>{{strip_tags(Auth::user()->profile->bio)}}</textarea> <textarea
class="form-control"
id="bio"
name="bio"
placeholder="Add a bio here"
rows="2"
data-max-length="{{config('pixelfed.max_bio_length')}}"
maxlength="{{config('pixelfed.max_bio_length')}}"
v-pre>{{strip_tags(Auth::user()->profile->bio)}}</textarea>
<p class="form-text"> <p class="form-text">
<span class="bio-counter float-right small text-muted">0/{{config('pixelfed.max_bio_length')}}</span> <span class="bio-counter float-right small text-muted">0/{{config('pixelfed.max_bio_length')}}</span>
</p> </p>