Skip to content

Commit a0096d9

Browse files
committed
Add too long error message if user tries to ab0se
1 parent b54b4eb commit a0096d9

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/controllers/User/Update.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,13 @@ public function &run(Router &$router, View &$view, array &$args) {
188188

189189
// biography change request
190190

191-
$model->profile->setBiography($model->biography);
192-
$model->biography_error = ['green', 'CHANGE_SUCCESS'];
193-
$profile_changed = true;
191+
if (strlen($model->biography) > $model->biography_max_len) {
192+
$model->biography_error = ['red', 'TOO_LONG'];
193+
} else {
194+
$model->profile->setBiography($model->biography);
195+
$model->biography_error = ['green', 'CHANGE_SUCCESS'];
196+
$profile_changed = true;
197+
}
194198

195199
}
196200

src/templates/User/Update.phtml

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ switch ($this->getContext()->display_name_error[1]) {
6060

6161
switch ($this->getContext()->biography_error[1]) {
6262
case null: case '': $biography_error = ''; break;
63-
case 'CHANGE_FAILED':
64-
$biography_error = 'Failed to change biography.'; break;
63+
case 'TOO_LONG':
64+
$biography_error = 'Your biography is too long.'; break;
6565
case 'CHANGE_SUCCESS':
6666
$biography_error = 'Your biography was updated.'; break;
6767
default:

0 commit comments

Comments
 (0)