| @@ 22-32 (lines=11) @@ | ||
| 19 | ||
| 20 | public function render() |
|
| 21 | { |
|
| 22 | if ($this->validator->errors()->first() == 'validation.min.string') { |
|
| 23 | return response()->json([ |
|
| 24 | 'code' => 'INVALID_NAME', |
|
| 25 | 'validationResult' => [ |
|
| 26 | 'resultType' => 'VALIDATION_ERROR_NAME_TOO_SHORT', |
|
| 27 | 'additionalInfo' => 2, |
|
| 28 | 'valid' => false, |
|
| 29 | ], |
|
| 30 | 'suggestions' => [User::randomNickname()], |
|
| 31 | ]); |
|
| 32 | } |
|
| 33 | ||
| 34 | if ($this->validator->errors()->first() == 'validation.max.string') { |
|
| 35 | return response()->json([ |
|
| @@ 34-44 (lines=11) @@ | ||
| 31 | ]); |
|
| 32 | } |
|
| 33 | ||
| 34 | if ($this->validator->errors()->first() == 'validation.max.string') { |
|
| 35 | return response()->json([ |
|
| 36 | 'code' => 'INVALID_NAME', |
|
| 37 | 'validationResult' => [ |
|
| 38 | 'resultType' => 'VALIDATION_ERROR_NAME_TOO_LONG', |
|
| 39 | 'additionalInfo' => 15, |
|
| 40 | 'valid' => false, |
|
| 41 | ], |
|
| 42 | 'suggestions' => [User::randomNickname()], |
|
| 43 | ]); |
|
| 44 | } |
|
| 45 | ||
| 46 | if ($this->validator->errors()->first() == 'validation.regex') { |
|
| 47 | return response()->json([ |
|
| @@ 46-56 (lines=11) @@ | ||
| 43 | ]); |
|
| 44 | } |
|
| 45 | ||
| 46 | if ($this->validator->errors()->first() == 'validation.regex') { |
|
| 47 | return response()->json([ |
|
| 48 | 'code' => 'INVALID_NAME', |
|
| 49 | 'validationResult' => [ |
|
| 50 | 'resultType' => 'VALIDATION_ERROR_ILLEGAL_CHARS', |
|
| 51 | 'additionalInfo' => null, |
|
| 52 | 'valid' => false, |
|
| 53 | ], |
|
| 54 | 'suggestions' => [], |
|
| 55 | ]); |
|
| 56 | } |
|
| 57 | ||
| 58 | if ($this->validator->errors()->first() == 'validation.user.taken') { |
|
| 59 | return response()->json([ |
|
| @@ 66-76 (lines=11) @@ | ||
| 63 | ]); |
|
| 64 | } |
|
| 65 | ||
| 66 | if ($this->validator->errors()->first() == 'validation.user.illegal.words') { |
|
| 67 | return response()->json([ |
|
| 68 | 'code' => 'INVALID_NAME', |
|
| 69 | 'validationResult' => [ |
|
| 70 | 'resultType' => 'VALIDATION_ERROR_ILLEGAL_WORDS', |
|
| 71 | 'additionalInfo' => '', |
|
| 72 | 'valid' => false, |
|
| 73 | ], |
|
| 74 | 'suggestions' => [User::randomNickname()], |
|
| 75 | ]); |
|
| 76 | } |
|
| 77 | ||
| 78 | return response()->json([ |
|
| 79 | 'code' => 'INVALID_NAME', |
|