mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 00:36:31 +02:00
feat: add maxLength constraints to auth and settings form inputs
Gives users immediate client-side feedback and prevents pathologically long values from being typed. Caps match Zod schema limits where they exist; email uses the RFC 5321 maximum. Files touched (5): - (home)/login/LocalLoginForm.tsx — email → 254 - (home)/register/page.tsx — email → 254 - dashboard/.../user-settings/.../ProfileContent.tsx — display name → 100 - components/settings/general-settings-manager.tsx — search space name → 100 - components/settings/roles-manager.tsx — role name (create+edit dialogs) → 100, role description (create+edit dialogs) → 500 Closes #948
This commit is contained in:
parent
4e68565a72
commit
b8e663e8f4
5 changed files with 8 additions and 0 deletions
|
|
@ -158,6 +158,7 @@ export function LocalLoginForm() {
|
|||
type="email"
|
||||
autoComplete="username"
|
||||
required
|
||||
maxLength={254}
|
||||
placeholder="you@example.com"
|
||||
value={username}
|
||||
onChange={(e) => setUsername(e.target.value)}
|
||||
|
|
|
|||
|
|
@ -237,6 +237,7 @@ export default function RegisterPage() {
|
|||
type="email"
|
||||
autoComplete="email"
|
||||
required
|
||||
maxLength={254}
|
||||
placeholder="you@example.com"
|
||||
value={email}
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ export function ProfileContent() {
|
|||
id="display-name"
|
||||
type="text"
|
||||
autoComplete="name"
|
||||
maxLength={100}
|
||||
placeholder={user?.email?.split("@")[0]}
|
||||
value={displayName}
|
||||
onChange={(e) => setDisplayName(e.target.value)}
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ export function GeneralSettingsManager({ searchSpaceId }: GeneralSettingsManager
|
|||
<Label htmlFor="search-space-name">{t("general_name_label")}</Label>
|
||||
<Input
|
||||
id="search-space-name"
|
||||
maxLength={100}
|
||||
placeholder={t("general_name_placeholder")}
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
|
|
|
|||
|
|
@ -876,6 +876,7 @@ function CreateRoleDialog({
|
|||
<Label htmlFor="role-name">Role Name *</Label>
|
||||
<Input
|
||||
id="role-name"
|
||||
maxLength={100}
|
||||
placeholder="e.g., Content Manager"
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
|
|
@ -885,6 +886,7 @@ function CreateRoleDialog({
|
|||
<Label htmlFor="role-description">Description</Label>
|
||||
<Input
|
||||
id="role-description"
|
||||
maxLength={500}
|
||||
placeholder="Brief description of this role"
|
||||
value={description}
|
||||
onChange={(e) => setDescription(e.target.value)}
|
||||
|
|
@ -1034,6 +1036,7 @@ function EditRoleDialog({
|
|||
<Label htmlFor="edit-role-name">Role Name *</Label>
|
||||
<Input
|
||||
id="edit-role-name"
|
||||
maxLength={100}
|
||||
placeholder="e.g., Content Manager"
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
|
|
@ -1043,6 +1046,7 @@ function EditRoleDialog({
|
|||
<Label htmlFor="edit-role-description">Description</Label>
|
||||
<Input
|
||||
id="edit-role-description"
|
||||
maxLength={500}
|
||||
placeholder="Brief description of this role"
|
||||
value={description}
|
||||
onChange={(e) => setDescription(e.target.value)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue