fix(email): preserve newlines in PGP key textarea fields (#2617)

This commit is contained in:
fallenbagel
2026-03-02 16:33:11 +05:00
committed by GitHub
parent 3557745b62
commit 835e9176c0
2 changed files with 14 additions and 7 deletions

View File

@@ -20,7 +20,7 @@ const SensitiveInput = ({ as = 'input', ...props }: SensitiveInputProps) => {
? props ? props
: { : {
...props, ...props,
as: props.type === 'textarea' && !isHidden ? 'textarea' : undefined, as: props.type === 'textarea' ? 'textarea' : undefined,
}; };
return ( return (
<> <>
@@ -32,12 +32,19 @@ const SensitiveInput = ({ as = 'input', ...props }: SensitiveInputProps) => {
{...componentProps} {...componentProps}
className={`rounded-l-only ${componentProps.className ?? ''}`} className={`rounded-l-only ${componentProps.className ?? ''}`}
type={ type={
isHidden props.type === 'textarea'
? undefined
: isHidden
? 'password' ? 'password'
: props.type !== 'password' : props.type !== 'password'
? (props.type ?? 'text') ? (props.type ?? 'text')
: 'text' : 'text'
} }
style={
props.type === 'textarea' && isHidden
? { WebkitTextSecurity: 'disc', ...props.style }
: props.style
}
/> />
<button <button
onClick={(e) => { onClick={(e) => {

View File

@@ -106,7 +106,7 @@ const NotificationsEmail = () => {
otherwise: Yup.string().nullable(), otherwise: Yup.string().nullable(),
}) })
.matches( .matches(
/-----BEGIN PGP PRIVATE KEY BLOCK-----.+-----END PGP PRIVATE KEY BLOCK-----/, /-----BEGIN PGP PRIVATE KEY BLOCK-----.+-----END PGP PRIVATE KEY BLOCK-----/s,
intl.formatMessage(messages.validationPgpPrivateKey) intl.formatMessage(messages.validationPgpPrivateKey)
), ),
pgpPassword: Yup.string().when('pgpPrivateKey', { pgpPassword: Yup.string().when('pgpPrivateKey', {