Replace all instances of 255 as a max length with 191; ref #2421

This commit is contained in:
Dane Everitt 2020-09-26 16:29:26 -07:00
parent 4f21fa85f8
commit cc6f98c0fd
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
24 changed files with 41 additions and 38 deletions

View file

@ -19,12 +19,12 @@ class EggFormRequest extends AdminFormRequest
public function rules()
{
$rules = [
'name' => 'required|string|max:255',
'name' => 'required|string|max:191',
'description' => 'nullable|string',
'docker_image' => 'required|string|max:255',
'docker_image' => 'required|string|max:191',
'startup' => 'required|string',
'config_from' => 'sometimes|bail|nullable|numeric',
'config_stop' => 'required_without:config_from|nullable|string|max:255',
'config_stop' => 'required_without:config_from|nullable|string|max:191',
'config_startup' => 'required_without:config_from|nullable|json',
'config_logs' => 'required_without:config_from|nullable|json',
'config_files' => 'required_without:config_from|nullable|json',

View file

@ -15,9 +15,9 @@ class EggVariableFormRequest extends AdminFormRequest
public function rules()
{
return [
'name' => 'required|string|min:1|max:255',
'name' => 'required|string|min:1|max:191',
'description' => 'sometimes|nullable|string',
'env_variable' => 'required|regex:/^[\w]{1,255}$/|notIn:' . EggVariable::RESERVED_ENV_NAMES,
'env_variable' => 'required|regex:/^[\w]{1,191}$/|notIn:' . EggVariable::RESERVED_ENV_NAMES,
'options' => 'sometimes|required|array',
'rules' => 'bail|required|string',
'default_value' => 'present',

View file

@ -19,7 +19,7 @@ class StoreNestFormRequest extends AdminFormRequest
public function rules()
{
return [
'name' => 'required|string|min:1|max:255',
'name' => 'required|string|min:1|max:191',
'description' => 'string|nullable',
];
}

View file

@ -20,7 +20,7 @@ class AllocationFormRequest extends AdminFormRequest
{
return [
'allocation_ip' => 'required|string',
'allocation_alias' => 'sometimes|nullable|string|max:255',
'allocation_alias' => 'sometimes|nullable|string|max:191',
'allocation_ports' => 'required|array',
];
}

View file

@ -15,8 +15,8 @@ class AdvancedSettingsFormRequest extends AdminFormRequest
{
return [
'recaptcha:enabled' => 'required|in:true,false',
'recaptcha:secret_key' => 'required|string|max:255',
'recaptcha:website_key' => 'required|string|max:255',
'recaptcha:secret_key' => 'required|string|max:191',
'recaptcha:website_key' => 'required|string|max:191',
'pterodactyl:guzzle:timeout' => 'required|integer|between:1,60',
'pterodactyl:guzzle:connect_timeout' => 'required|integer|between:1,60',
'pterodactyl:console:count' => 'required|integer|min:1',

View file

@ -16,7 +16,7 @@ class BaseSettingsFormRequest extends AdminFormRequest
public function rules()
{
return [
'app:name' => 'required|string|max:255',
'app:name' => 'required|string|max:191',
'pterodactyl:auth:2fa_required' => 'required|integer|in:0,1,2',
'app:locale' => ['required', 'string', Rule::in(array_keys($this->getAvailableLanguages()))],
'app:analytics' => 'nullable|string',

View file

@ -18,10 +18,10 @@ class MailSettingsFormRequest extends AdminFormRequest
'mail:host' => 'required|string',
'mail:port' => 'required|integer|between:1,65535',
'mail:encryption' => ['present', Rule::in([null, 'tls', 'ssl'])],
'mail:username' => 'nullable|string|max:255',
'mail:password' => 'nullable|string|max:255',
'mail:username' => 'nullable|string|max:191',
'mail:password' => 'nullable|string|max:191',
'mail:from:address' => 'required|string|email',
'mail:from:name' => 'nullable|string|max:255',
'mail:from:name' => 'nullable|string|max:191',
];
}

View file

@ -24,7 +24,7 @@ class StoreAllocationRequest extends ApplicationApiRequest
{
return [
'ip' => 'required|string',
'alias' => 'sometimes|nullable|string|max:255',
'alias' => 'sometimes|nullable|string|max:191',
'ports' => 'required|array',
'ports.*' => 'string',
];

View file

@ -21,7 +21,7 @@ class StoreBackupRequest extends ClientApiRequest
public function rules(): array
{
return [
'name' => 'nullable|string|max:255',
'name' => 'nullable|string|max:191',
'ignored' => 'nullable|string',
];
}

View file

@ -20,7 +20,7 @@ class StoreSubuserRequest extends SubuserRequest
public function rules(): array
{
return [
'email' => 'required|email',
'email' => 'required|email|between:1,191',
'permissions' => 'required|array',
'permissions.*' => 'string',
];

View file

@ -50,7 +50,7 @@ class DatabaseHost extends Model
* @var array
*/
public static $validationRules = [
'name' => 'required|string|max:255',
'name' => 'required|string|max:191',
'host' => 'required|string',
'port' => 'required|numeric|between:1,65535',
'username' => 'required|string|max:32',

View file

@ -93,13 +93,13 @@ class Egg extends Model
public static $validationRules = [
'nest_id' => 'required|bail|numeric|exists:nests,id',
'uuid' => 'required|string|size:36',
'name' => 'required|string|max:255',
'name' => 'required|string|max:191',
'description' => 'string|nullable',
'author' => 'required|string|email',
'docker_image' => 'required|string|max:255',
'docker_image' => 'required|string|max:191',
'startup' => 'required|nullable|string',
'config_from' => 'sometimes|bail|nullable|numeric|exists:eggs,id',
'config_stop' => 'required_without:config_from|nullable|string|max:255',
'config_stop' => 'required_without:config_from|nullable|string|max:191',
'config_startup' => 'required_without:config_from|nullable|json',
'config_logs' => 'required_without:config_from|nullable|json',
'config_files' => 'required_without:config_from|nullable|json',

View file

@ -73,9 +73,9 @@ class EggVariable extends Model
*/
public static $validationRules = [
'egg_id' => 'exists:eggs,id',
'name' => 'required|string|between:1,255',
'name' => 'required|string|between:1,191',
'description' => 'string',
'env_variable' => 'required|regex:/^[\w]{1,255}$/|notIn:' . self::RESERVED_ENV_NAMES,
'env_variable' => 'required|regex:/^[\w]{1,191}$/|notIn:' . self::RESERVED_ENV_NAMES,
'default_value' => 'string',
'user_viewable' => 'boolean',
'user_editable' => 'boolean',

View file

@ -41,7 +41,7 @@ class Location extends Model
*/
public static $validationRules = [
'short' => 'required|string|between:1,60|unique:locations,short',
'long' => 'string|nullable|between:1,255',
'long' => 'string|nullable|between:1,191',
];
/**

View file

@ -56,7 +56,7 @@ class Mount extends Model
*/
public static $validationRules = [
'name' => 'required|string|min:2|max:64|unique:mounts,name',
'description' => 'nullable|string|max:255',
'description' => 'nullable|string|max:191',
'source' => 'required|string',
'target' => 'required|string',
'read_only' => 'sometimes|boolean',

View file

@ -44,7 +44,7 @@ class Nest extends Model
*/
public static $validationRules = [
'author' => 'required|string|email',
'name' => 'required|string|max:255',
'name' => 'required|string|max:191',
'description' => 'nullable|string',
];

View file

@ -103,7 +103,7 @@ class Schedule extends Model
*/
public static $validationRules = [
'server_id' => 'required|exists:servers,id',
'name' => 'required|string|max:255',
'name' => 'required|string|max:191',
'cron_day_of_week' => 'required|string',
'cron_day_of_month' => 'required|string',
'cron_hour' => 'required|string',

View file

@ -103,7 +103,7 @@ class Server extends Model
public static $validationRules = [
'external_id' => 'sometimes|nullable|string|between:1,191|unique:servers',
'owner_id' => 'required|integer|exists:users,id',
'name' => 'required|string|min:1|max:255',
'name' => 'required|string|min:1|max:191',
'node_id' => 'required|exists:nodes,id',
'description' => 'string',
'memory' => 'required|numeric|min:0',
@ -118,7 +118,7 @@ class Server extends Model
'egg_id' => 'required|exists:eggs,id',
'startup' => 'required|string',
'skip_scripts' => 'sometimes|boolean',
'image' => 'required|string|max:255',
'image' => 'required|string|max:191',
'installed' => 'in:0,1,2',
'database_limit' => 'present|nullable|integer|min:0',
'allocation_limit' => 'sometimes|nullable|integer|min:0',

View file

@ -25,7 +25,7 @@ class Setting extends Model
* @var array
*/
public static $validationRules = [
'key' => 'required|string|between:1,255',
'key' => 'required|string|between:1,191',
'value' => 'string',
];
}

View file

@ -137,11 +137,11 @@ class User extends Model implements
*/
public static $validationRules = [
'uuid' => 'required|string|size:36|unique:users,uuid',
'email' => 'required|email|unique:users,email',
'external_id' => 'sometimes|nullable|string|max:255|unique:users,external_id',
'username' => 'required|between:1,255|unique:users,username',
'name_first' => 'required|string|between:1,255',
'name_last' => 'required|string|between:1,255',
'email' => 'required|email|between:1,191|unique:users,email',
'external_id' => 'sometimes|nullable|string|max:191|unique:users,external_id',
'username' => 'required|between:1,191|unique:users,username',
'name_first' => 'required|string|between:1,191',
'name_last' => 'required|string|between:1,191',
'password' => 'sometimes|nullable|string',
'root_admin' => 'boolean',
'language' => 'string',

View file

@ -87,7 +87,7 @@ export default () => {
onSubmit={submit}
initialValues={{ name: '', ignored: '' }}
validationSchema={object().shape({
name: string().max(255),
name: string().max(191),
ignored: string(),
})}
>

View file

@ -250,7 +250,10 @@ export default ({ subuser, ...props }: Props) => {
permissions: subuser?.permissions || [],
} as Values}
validationSchema={object().shape({
email: string().email('A valid email address must be provided.').required('A valid email address must be provided.'),
email: string()
.max(191, 'Email addresses must not exceed 191 characters.')
.email('A valid email address must be provided.')
.required('A valid email address must be provided.'),
permissions: array().of(string()),
})}
>

View file

@ -70,7 +70,7 @@
<div class="col-md-12">
<label for="pLongModal" class="form-label">Description</label>
<textarea name="long" id="pLongModal" class="form-control" rows="4"></textarea>
<p class="text-muted small">A longer description of this location. Must be less than 255 characters.</p>
<p class="text-muted small">A longer description of this location. Must be less than 191 characters.</p>
</div>
</div>
</div>

View file

@ -84,7 +84,7 @@
<div class="col-md-12">
<label for="pDescription" class="form-label">Description</label>
<textarea id="pDescription" name="description" class="form-control" rows="4"></textarea>
<p class="text-muted small">A longer description for this mount, must be less than 255 characters.</p>
<p class="text-muted small">A longer description for this mount, must be less than 191 characters.</p>
</div>
<div class="col-md-6">