Skip to content

Commit

Permalink
Add too long error message if user tries to ab0se
Browse files Browse the repository at this point in the history
  • Loading branch information
carlbennett committed Feb 12, 2019
1 parent b54b4eb commit a0096d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/controllers/User/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,13 @@ public function &run(Router &$router, View &$view, array &$args) {

// biography change request

$model->profile->setBiography($model->biography);
$model->biography_error = ['green', 'CHANGE_SUCCESS'];
$profile_changed = true;
if (strlen($model->biography) > $model->biography_max_len) {
$model->biography_error = ['red', 'TOO_LONG'];
} else {
$model->profile->setBiography($model->biography);
$model->biography_error = ['green', 'CHANGE_SUCCESS'];
$profile_changed = true;
}

}

Expand Down
4 changes: 2 additions & 2 deletions src/templates/User/Update.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ switch ($this->getContext()->display_name_error[1]) {

switch ($this->getContext()->biography_error[1]) {
case null: case '': $biography_error = ''; break;
case 'CHANGE_FAILED':
$biography_error = 'Failed to change biography.'; break;
case 'TOO_LONG':
$biography_error = 'Your biography is too long.'; break;
case 'CHANGE_SUCCESS':
$biography_error = 'Your biography was updated.'; break;
default:
Expand Down

0 comments on commit a0096d9

Please sign in to comment.