@@ -23,6 +23,7 @@ const globalSettingQuery = new GlobalSettingQuery();
2323
2424const smtpSetting: Ref <SmtpConfig > = ref ({});
2525const smtpEnabled: Ref <boolean > = ref (false )
26+ const smtpPasswordConfigured: Ref <boolean > = ref (false )
2627const testEmail = ref (' ' )
2728loadSmtpSettings ()
2829
@@ -49,6 +50,14 @@ async function loadSmtpSettings() {
4950 for (const [key, value] of Object .entries (GLOBAL_SETTINGS_SMTP_STRING_MAPPING )) {
5051 const { retrieved } = await globalSettingQuery .get (value )
5152 if (retrieved ) {
53+ // The password is never returned by the API, even encrypted: it's
54+ // always masked to null. Track whether one is configured instead of
55+ // prefilling the field with it.
56+ if (key === ' password' ) {
57+ smtpPasswordConfigured .value = !! retrieved .hasValue
58+ continue
59+ }
60+
5261 let setValue: string | null = null
5362 if (retrieved .value ) {
5463 setValue = retrieved .value
@@ -148,8 +157,16 @@ async function testSmtp() {
148157 <UInput v-model =" smtpSetting .username " />
149158 </UFormField >
150159
151- <UFormField label="Mot de passe" name="password">
152- <UInput v-model =" smtpSetting .password " type="password" />
160+ <UFormField
161+ label="Mot de passe"
162+ name="password"
163+ :hint =" smtpPasswordConfigured ? ' Laissez vide pour conserver le mot de passe actuel' : undefined "
164+ >
165+ <UInput
166+ v-model =" smtpSetting .password "
167+ type="password"
168+ :placeholder =" smtpPasswordConfigured ? ' ••••••••' : undefined "
169+ />
153170 </UFormField >
154171
155172 <UFormField label="Email expéditeur" name="sender" required>
0 commit comments