| @@ 384-389 (lines=6) @@ | ||
| 381 | 'key', 'type', 'description' |
|
| 382 | ]); |
|
| 383 | $errors = $mapper->validate(false); |
|
| 384 | if (is_array($errors)) { |
|
| 385 | $this->notify(['warning' => $mapper->validationErrors($errors)]); |
|
| 386 | $f3->set('form', $f3->get('REQUEST')); |
|
| 387 | echo \View::instance()->render($view); |
|
| 388 | return; |
|
| 389 | } |
|
| 390 | ||
| 391 | // no change, do nothing |
|
| 392 | if (!$mapper->changed()) { |
|
| @@ 299-304 (lines=6) @@ | ||
| 296 | ||
| 297 | $data = $this->filterPageInput($f3, $mapper); |
|
| 298 | $errors = $mapper->validate(false); |
|
| 299 | if (is_array($errors)) { |
|
| 300 | $this->notify(['warning' => $mapper->validationErrors($errors)]); |
|
| 301 | $f3->set('form', $f3->get('REQUEST')); |
|
| 302 | echo \View::instance()->render($view); |
|
| 303 | return; |
|
| 304 | } |
|
| 305 | ||
| 306 | // no change, do nothing |
|
| 307 | if (!$mapper->changed()) { |
|
| @@ 408-413 (lines=6) @@ | ||
| 405 | $data = $this->filterPageInput($f3, $mapper); |
|
| 406 | ||
| 407 | $errors = $mapper->validate(false); |
|
| 408 | if (is_array($errors)) { |
|
| 409 | $this->notify(['warning' => $mapper->validationErrors($errors)]); |
|
| 410 | $f3->set('form', $data); |
|
| 411 | echo \View::instance()->render($view); |
|
| 412 | return; |
|
| 413 | } |
|
| 414 | ||
| 415 | // no change, do nothing |
|
| 416 | if (!$mapper->changed()) { |
|
| @@ 197-202 (lines=6) @@ | ||
| 194 | $mapper->copyfrom($data); |
|
| 195 | $mapper->validationRequired($fields); |
|
| 196 | $errors = $mapper->validate(false); |
|
| 197 | if (is_array($errors)) { |
|
| 198 | $this->notify(['warning' => $mapper->validationErrors($errors)]); |
|
| 199 | $f3->set('form', $f3->get('REQUEST')); |
|
| 200 | echo \View::instance()->render($view); |
|
| 201 | return; |
|
| 202 | } |
|
| 203 | ||
| 204 | // no change, do nothing |
|
| 205 | if (!$mapper->changed()) { |
|
| @@ 332-337 (lines=6) @@ | ||
| 329 | $mapper->copyfrom($data); |
|
| 330 | $mapper->validationRequired($fields); |
|
| 331 | $errors = $mapper->validate(false); |
|
| 332 | if (is_array($errors)) { |
|
| 333 | $this->notify(['warning' => $mapper->validationErrors($errors)]); |
|
| 334 | $f3->set('form', $f3->get('REQUEST')); |
|
| 335 | echo \View::instance()->render($view); |
|
| 336 | return; |
|
| 337 | } |
|
| 338 | ||
| 339 | // no change, do nothing |
|
| 340 | if (!$mapper->changed()) { |
|
| @@ 216-221 (lines=6) @@ | ||
| 213 | $usersMapper->copyfrom($data); |
|
| 214 | $usersMapper->validationRequired($fields); |
|
| 215 | $errors = $usersMapper->validate(false); |
|
| 216 | if (is_array($errors)) { |
|
| 217 | $this->notify(['warning' => $usersMapper->validationErrors($errors)]); |
|
| 218 | $f3->set('form', $f3->get('REQUEST')); |
|
| 219 | echo \View::instance()->render($view); |
|
| 220 | return; |
|
| 221 | } |
|
| 222 | ||
| 223 | // no change, do nothing |
|
| 224 | if ($usersMapper->cast() === $oldUserMapper->cast()) { |
|
| @@ 257-262 (lines=6) @@ | ||
| 254 | $mapper->copyfrom($data); |
|
| 255 | $mapper->validationRequired($fields); |
|
| 256 | $errors = $mapper->validate(false); |
|
| 257 | if (is_array($errors)) { |
|
| 258 | $this->notify(['warning' => $mapper->validationErrors($errors)]); |
|
| 259 | $f3->set('form', $f3->get('REQUEST')); |
|
| 260 | echo \View::instance()->render($view); |
|
| 261 | return; |
|
| 262 | } |
|
| 263 | ||
| 264 | // no change, do nothing |
|
| 265 | if ($mapper->changed()) { |
|
| @@ 393-398 (lines=6) @@ | ||
| 390 | $mapper->copyfrom($data); |
|
| 391 | $mapper->validationRequired($fields); |
|
| 392 | $errors = $mapper->validate(false); |
|
| 393 | if (is_array($errors)) { |
|
| 394 | $this->notify(['warning' => $mapper->validationErrors($errors)]); |
|
| 395 | $f3->set('form', $f3->get('REQUEST')); |
|
| 396 | echo \View::instance()->render($view); |
|
| 397 | return; |
|
| 398 | } |
|
| 399 | ||
| 400 | // no change, do nothing |
|
| 401 | if (!$mapper->changed()) { |
|
| @@ 148-153 (lines=6) @@ | ||
| 145 | $errors = $this->validate(false, $f3->get('REQUEST')); |
|
| 146 | ||
| 147 | // if errors display form |
|
| 148 | if (is_array($errors)) { |
|
| 149 | $this->notify(['info' => $oAuth2Model->validationErrors($errors)]); |
|
| 150 | $f3->set('form', $f3->get('REQUEST')); |
|
| 151 | echo \View::instance()->render($view); |
|
| 152 | return; |
|
| 153 | } |
|
| 154 | ||
| 155 | // validate response_type - only one type is allowed anyway |
|
| 156 | if ('code' !== $request['response_type']) { |
|
| @@ 238-243 (lines=6) @@ | ||
| 235 | $usersMapper->copyfrom($data); |
|
| 236 | $usersMapper->validationRequired($fields); |
|
| 237 | $errors = $usersMapper->validate(false); |
|
| 238 | if (is_array($errors)) { |
|
| 239 | $this->notify(['warning' => $usersMapper->validationErrors($errors)]); |
|
| 240 | $f3->set('form', $f3->get('REQUEST')); |
|
| 241 | echo \View::instance()->render($view); |
|
| 242 | return; |
|
| 243 | } |
|
| 244 | ||
| 245 | // no change, do nothing |
|
| 246 | if (!$usersMapper->changed()) { |
|
| @@ 370-375 (lines=6) @@ | ||
| 367 | ||
| 368 | $errors = $usersMapper->validate(false); |
|
| 369 | ||
| 370 | if (is_array($errors)) { |
|
| 371 | $this->notify(['info' => $usersMapper->validationErrors($errors)]); |
|
| 372 | $f3->set('form', $f3->get('REQUEST')); |
|
| 373 | echo \View::instance()->render($view); |
|
| 374 | return; |
|
| 375 | } |
|
| 376 | ||
| 377 | if (!$usersModel->register()) { |
|
| 378 | $this->notify(_('Registration failed!'), 'error'); |
|
| @@ 583-588 (lines=6) @@ | ||
| 580 | $errors = $this->validate(false, $profileData, [ |
|
| 581 | 'nickname' => 'valid_name', |
|
| 582 | ]); |
|
| 583 | if (is_array($errors)) { |
|
| 584 | $this->notify(['warning' => $this->validationErrors($errors)]); |
|
| 585 | $f3->set('form', $f3->get('REQUEST')); |
|
| 586 | echo \View::instance()->render($view); |
|
| 587 | return; |
|
| 588 | } |
|
| 589 | ||
| 590 | // save profile |
|
| 591 | $usersModel->saveData($f3->get('uuid'), $profileData); |
|