Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Do not truncate revealed password, instead allow to span to multiple lines (#2321)

Leendert de Borstc9bdcec748b3
diff --git a/apps/browser-extension/src/entrypoints/popup/components/Forms/FormInputCopyToClipboard.tsx b/apps/browser-extension/src/entrypoints/popup/components/Forms/FormInputCopyToClipboard.tsx
index 2d8adc149..1a0f28a5c 100644
--- a/apps/browser-extension/src/entrypoints/popup/components/Forms/FormInputCopyToClipboard.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/components/Forms/FormInputCopyToClipboard.tsx
@@ -100,6 +100,8 @@ export const FormInputCopyToClipboard: React.FC<FormInputCopyToClipboardProps> =
}
};
+ const isRevealedPassword = type === 'password' && showPassword;
+
return (
<div>
<label htmlFor={id} className="block mb-2 text-sm font-medium text-gray-700 dark:text-gray-300">
@@ -107,19 +109,32 @@ export const FormInputCopyToClipboard: React.FC<FormInputCopyToClipboardProps> =
{labelSuffix}
</label>
<div className="relative">
- <input
- type={type === 'password' && !showPassword ? 'password' : 'text'}
- id={id}
- readOnly
- value={value}
- onClick={copyToClipboard}
- className={`w-full pl-3 py-2.5 bg-white border ${
- copied ? 'border-green-500 border-2' : 'border-gray-300'
- } text-gray-900 text-sm rounded-lg shadow-sm focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 truncate ${
- type === 'password' ? 'pr-16' : 'pr-10'
- }`}
- />
- <div className="absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-2">
+ {isRevealedPassword ? (
+ /* Revealed passwords are rendered as wrapping text so long values stay fully readable instead of being truncated. */
+ <div
+ id={id}
+ onClick={copyToClipboard}
+ className={`w-full pl-3 py-2.5 pr-16 bg-white border ${
+ copied ? 'border-green-500 border-2' : 'border-gray-300'
+ } text-gray-900 text-sm rounded-lg shadow-sm dark:bg-gray-700 dark:border-gray-600 dark:text-white break-all whitespace-pre-wrap cursor-pointer min-h-[42px]`}
+ >
+ {value}
+ </div>
+ ) : (
+ <input
+ type={type === 'password' ? 'password' : 'text'}
+ id={id}
+ readOnly
+ value={value}
+ onClick={copyToClipboard}
+ className={`w-full pl-3 py-2.5 bg-white border ${
+ copied ? 'border-green-500 border-2' : 'border-gray-300'
+ } text-gray-900 text-sm rounded-lg shadow-sm focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 truncate ${
+ type === 'password' ? 'pr-16' : 'pr-10'
+ }`}
+ />
+ )}
+ <div className={`absolute right-2 flex items-center gap-2 ${isRevealedPassword ? 'top-2' : 'top-1/2 -translate-y-1/2'}`}>
{copied ? (
<button
type="button"
diff --git a/apps/mobile-app/components/form/FormInputCopyToClipboard.tsx b/apps/mobile-app/components/form/FormInputCopyToClipboard.tsx
index a77940ece..8f0ccf793 100644
--- a/apps/mobile-app/components/form/FormInputCopyToClipboard.tsx
+++ b/apps/mobile-app/components/form/FormInputCopyToClipboard.tsx
@@ -105,6 +105,7 @@ const FormInputCopyToClipboard: React.FC<FormInputCopyToClipboardProps> = ({
}
};
+ const isRevealedPassword = type === 'password' && isPasswordVisible;
const displayValue = type === 'password' && !isPasswordVisible
? '•'.repeat(value?.length || 0)
: value;
@@ -185,7 +186,8 @@ const FormInputCopyToClipboard: React.FC<FormInputCopyToClipboardProps> = ({
{labelSuffix}
</View>
)}
- <Text style={styles.value} numberOfLines={1} ellipsizeMode="tail">
+ {/* Revealed passwords wrap across lines so long values stay fully readable instead of being truncated. */}
+ <Text style={styles.value} numberOfLines={isRevealedPassword ? 0 : 1} ellipsizeMode="tail" selectable={isRevealedPassword}>
{displayValue}
</Text>
</View>
diff --git a/apps/mobile-app/components/form/PasswordGeneratorPanel.tsx b/apps/mobile-app/components/form/PasswordGeneratorPanel.tsx
index 922ecdb8a..1e5bcb3a0 100644
--- a/apps/mobile-app/components/form/PasswordGeneratorPanel.tsx
+++ b/apps/mobile-app/components/form/PasswordGeneratorPanel.tsx
@@ -312,7 +312,8 @@ export function PasswordGeneratorPanel({ initialSettings, onSettingsChange, onPr
{/* Preview. */}
<View style={styles.previewContainer}>
- <ThemedText style={styles.previewText} numberOfLines={1} ellipsizeMode="tail">
+ {/* Wraps across lines so long generated passwords stay fully readable. */}
+ <ThemedText style={styles.previewText} selectable>
{previewPassword}
</ThemedText>
<TouchableOpacity style={styles.refreshButton} onPress={handleRefreshPreview} activeOpacity={0.7}>
diff --git a/apps/mobile-app/components/items/FieldHistoryModal.tsx b/apps/mobile-app/components/items/FieldHistoryModal.tsx
index 4d02ce60d..04146ecf9 100644
--- a/apps/mobile-app/components/items/FieldHistoryModal.tsx
+++ b/apps/mobile-app/components/items/FieldHistoryModal.tsx
@@ -302,7 +302,8 @@ const FieldHistoryModal: React.FC<FieldHistoryModalProps> = ({
return (
<View key={idx} style={styles.historyValue}>
- <Text style={styles.valueText} numberOfLines={1} ellipsizeMode="tail">
+ {/* Revealed values wrap across lines so long secrets stay fully readable instead of being truncated. */}
+ <Text style={styles.valueText} numberOfLines={shouldMaskByDefault && isVisible ? 0 : 1} ellipsizeMode="tail" selectable={shouldMaskByDefault && isVisible}>
{displayValue}
</Text>
<View style={styles.actions}>
diff --git a/apps/server/AliasVault.Client/Main/Components/Forms/CopyPastePasswordFormRow.razor b/apps/server/AliasVault.Client/Main/Components/Forms/CopyPastePasswordFormRow.razor
index 202c544f7..196819379 100644
--- a/apps/server/AliasVault.Client/Main/Components/Forms/CopyPastePasswordFormRow.razor
+++ b/apps/server/AliasVault.Client/Main/Components/Forms/CopyPastePasswordFormRow.razor
@@ -5,7 +5,15 @@
<label for="@Id" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">@Label</label>
<div class="relative">
- <input type="@(IsPasswordVisible ? "text" : "password")" id="@Id" class="outline-0 shadow-sm bg-gray-50 border @(Copied ? "border-green-500 border-2" : "border-gray-300") text-gray-900 sm:text-sm rounded-lg block w-full p-2.5 pr-20 dark:bg-gray-700 dark:border-@(Copied ? "green-500" : "gray-600") dark:placeholder-gray-400 dark:text-white" value="@Value" @onclick="CopyToClipboard" readonly>
+ @if (IsPasswordVisible)
+ {
+ @* Visible passwords are rendered as wrapping text so long values stay fully readable instead of being clipped by the single-line input. *@
+ <div id="@Id" class="outline-0 shadow-sm bg-gray-50 border @(Copied ? "border-green-500 border-2" : "border-gray-300") text-gray-900 sm:text-sm rounded-lg block w-full p-2.5 pr-20 min-h-[42px] break-all cursor-pointer dark:bg-gray-700 dark:border-@(Copied ? "green-500" : "gray-600") dark:text-white" @onclick="CopyToClipboard">@Value</div>
+ }
+ else
+ {
+ <input type="password" id="@Id" class="outline-0 shadow-sm bg-gray-50 border @(Copied ? "border-green-500 border-2" : "border-gray-300") text-gray-900 sm:text-sm rounded-lg block w-full p-2.5 pr-20 dark:bg-gray-700 dark:border-@(Copied ? "green-500" : "gray-600") dark:placeholder-gray-400 dark:text-white" value="@Value" @onclick="CopyToClipboard" readonly>
+ }
<button type="button" class="absolute inset-y-1 right-1 flex items-center justify-center w-10 h-8 text-gray-500 bg-gray-200 rounded-md shadow-sm hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition-colors duration-200 dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-gray-300" @onclick="TogglePasswordVisibility">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
@if (IsPasswordVisible)
@@ -21,7 +29,7 @@
</button>
@if (Copied)
{
- <span class="absolute inset-y-0 right-10 flex items-center pr-3 text-green-500 dark:text-green-400">
+ <span class="absolute top-1 h-8 right-10 flex items-center pr-3 text-green-500 dark:text-green-400">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path d="M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z"></path>
<path d="M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z"></path>
diff --git a/apps/server/AliasVault.Client/wwwroot/css/tailwind.css b/apps/server/AliasVault.Client/wwwroot/css/tailwind.css
index aef9fec34..9edd8efb6 100644
--- a/apps/server/AliasVault.Client/wwwroot/css/tailwind.css
+++ b/apps/server/AliasVault.Client/wwwroot/css/tailwind.css
@@ -694,6 +694,10 @@ video {
top: 0px;
}
+.top-1 {
+ top: 0.25rem;
+}
+
.top-1\/2 {
top: 50%;
}
@@ -1117,6 +1121,10 @@ video {
min-height: 40px;
}
+.min-h-\[42px\] {
+ min-height: 42px;
+}
+
.min-h-\[600px\] {
min-height: 600px;
}