@@ -74,7 +74,7 @@ const EditCredential: React.FC<EditCredentialProps> = ({
7474 website : credentials . website || '' ,
7575 username : credentials . username || '' ,
7676 password : credentials . password || '' ,
77- twoFactor : credentials . twoFactor || ''
77+ twoFactor : ''
7878 } ) ;
7979 } else if ( type === 'keypair' ) {
8080 if ( credentials . host ) {
@@ -113,8 +113,10 @@ const EditCredential: React.FC<EditCredentialProps> = ({
113113 password : password ,
114114 } ;
115115
116- if ( twoFactor !== '' ) {
116+ if ( twoFactor && twoFactor . trim ( ) !== '' ) {
117117 credential . twoFactor = twoFactor . toUpperCase ( ) ;
118+ } else if ( credentials . twoFactor ) {
119+ credential . twoFactor = credentials . twoFactor ;
118120 }
119121
120122 await invoke ( 'update_credential' , {
@@ -243,14 +245,20 @@ const EditCredential: React.FC<EditCredentialProps> = ({
243245 ) }
244246 </ div >
245247 < div className = "space-y-1" >
246- < Label > 2FA - Optional</ Label >
248+ < Label > 2FA Secret (TOTP) - Optional</ Label >
247249 < Input
248250 type = "password"
251+ className = "border-yellow-600"
249252 { ...registerAccount ( 'twoFactor' ) }
250253 />
251- < small className = "text-gray-500" >
252- Leave empty if you don't have 2FA
253- enabled. You can enable it later.
254+ < small className = "text-yellow-600 dark:text-yellow-500 font-medium" >
255+ { credentials . twoFactor ? (
256+ < >
257+ ⚠️ 2FA is currently enabled. Leave empty to keep existing secret.
258+ </ >
259+ ) : (
260+ < > Leave empty if no 2FA is enabled. Enter new TOTP secret to enable.</ >
261+ ) }
254262 </ small >
255263 </ div >
256264 </ CardContent >
@@ -420,4 +428,4 @@ const EditCredential: React.FC<EditCredentialProps> = ({
420428 ) ;
421429} ;
422430
423- export default EditCredential ;
431+ export default EditCredential ;
0 commit comments