mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-24 08:01:38 +00:00
trim whitespaces from license key input field (#7084)
- Add onBlur prop support to Password component - Trim license key on blur in InstanceSetting component - Trim license key before saving in InstanceSettings component This ensures leading and trailing whitespace is always removed from the license key input field, both when the user leaves the field and when settings are saved. Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
This commit is contained in:
@@ -368,6 +368,11 @@
|
||||
onKeyDown={() => {
|
||||
licenseKeyChanged = true
|
||||
}}
|
||||
onBlur={() => {
|
||||
if ($values[setting.key] && typeof $values[setting.key] === 'string') {
|
||||
$values[setting.key] = $values[setting.key].trim()
|
||||
}
|
||||
}}
|
||||
bind:password={$values[setting.key]}
|
||||
/>
|
||||
<Button
|
||||
|
||||
@@ -136,6 +136,11 @@
|
||||
|
||||
let shouldReloadPage = false
|
||||
if ($values) {
|
||||
// Trim license key before saving
|
||||
if ($values['license_key'] && typeof $values['license_key'] === 'string') {
|
||||
$values['license_key'] = $values['license_key'].trim()
|
||||
}
|
||||
|
||||
const allSettings = [...Object.values(settings), scimSamlSetting].flatMap((x) =>
|
||||
Object.entries(x)
|
||||
)
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
required?: boolean
|
||||
small?: boolean
|
||||
onKeyDown?: (event: KeyboardEvent) => void
|
||||
onBlur?: (event: FocusEvent) => void
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -17,7 +18,8 @@
|
||||
disabled = false,
|
||||
required = false,
|
||||
small = false,
|
||||
onKeyDown
|
||||
onKeyDown,
|
||||
onBlur
|
||||
}: Props = $props()
|
||||
|
||||
let red = $derived(required && (password == '' || password == undefined))
|
||||
@@ -43,6 +45,7 @@
|
||||
type="password"
|
||||
bind:value={password}
|
||||
onkeydown={onKeyDown}
|
||||
onblur={onBlur}
|
||||
autocomplete="new-password"
|
||||
{placeholder}
|
||||
{disabled}
|
||||
@@ -55,6 +58,7 @@
|
||||
type="text"
|
||||
bind:value={password}
|
||||
onkeydown={bubble('keydown')}
|
||||
onblur={onBlur}
|
||||
autocomplete="new-password"
|
||||
{placeholder}
|
||||
{disabled}
|
||||
|
||||
Reference in New Issue
Block a user