Skip to content

A free open source IT asset/license management system

Updated validation, switch to string() as db field type

snipe2d6270c697d6
diff --git a/app/Models/User.php b/app/Models/User.php
index bc239063a4..5374b5e284 100644
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -116,9 +116,9 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
'start_date' => 'nullable|date_format:Y-m-d',
'end_date' => 'nullable|date_format:Y-m-d|after_or_equal:start_date',
'autoassign_licenses' => 'boolean',
- 'address' => 'max:191|nullable',
- 'city' => 'max:191|nullable',
- 'state' => 'min:2|max:191|nullable',
+ 'address' => 'nullable|string|max:191',
+ 'city' => 'nullable|string|max:191',
+ 'state' => 'nullable|string|max:191',
'country' => 'min:2|max:191|nullable',
'zip' => 'max:10|nullable',
'vip' => 'boolean',
diff --git a/database/migrations/2025_08_19_174823_add_display_name_to_ldap_settings.php b/database/migrations/2025_08_19_174823_add_display_name_to_ldap_settings.php
index f1a80adfb6..fb980af6dd 100644
--- a/database/migrations/2025_08_19_174823_add_display_name_to_ldap_settings.php
+++ b/database/migrations/2025_08_19_174823_add_display_name_to_ldap_settings.php
@@ -14,27 +14,27 @@ return new class extends Migration
Schema::table('settings', function (Blueprint $table) {
if (!Schema::hasColumn('settings', 'ldap_display_name')) {
- $table->text('ldap_display_name')->after('ldap_fname_field')->nullable()->default(null);
+ $table->string('ldap_display_name', 191)->after('ldap_fname_field')->nullable()->default(null);
}
if (!Schema::hasColumn('settings', 'ldap_zip')) {
- $table->text('ldap_zip')->after('ldap_manager')->nullable()->default(null);
+ $table->string('ldap_zip', 191)->after('ldap_manager')->nullable()->default(null);
}
if (!Schema::hasColumn('settings', 'ldap_state')) {
- $table->text('ldap_state')->after('ldap_manager')->nullable()->default(null);
+ $table->string('ldap_state', 191)->after('ldap_manager')->nullable()->default(null);
}
if (!Schema::hasColumn('settings', 'ldap_city')) {
- $table->text('ldap_city')->after('ldap_manager')->nullable()->default(null);
+ $table->string('ldap_city', 191)->after('ldap_manager')->nullable()->default(null);
}
if (!Schema::hasColumn('settings', 'ldap_address')) {
- $table->text('ldap_address')->after('ldap_manager')->nullable()->default(null);
+ $table->string('ldap_address', 191)->after('ldap_manager')->nullable()->default(null);
}
if (!Schema::hasColumn('settings', 'ldap_mobile')) {
- $table->text('ldap_mobile')->after('ldap_phone_field')->nullable()->default(null);
+ $table->string('ldap_mobile', 191)->after('ldap_phone_field')->nullable()->default(null);
}
});