Skip to content

Commit c591ad4

Browse files
committed
feat: enhance HIBP tooltip functionality in password history component
- Added a tooltip to display detailed information about the HIBP status of passwords in the password history table. - Implemented a new method `getHibpTooltip` to provide contextual messages based on the HIBP check results, improving user understanding of password security status.
1 parent aaaf5a2 commit c591ad4

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

apps/web/src/pages/identities/table/[_id]/password-history.vue

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
text-color="white"
5656
:label="getHibpLabel(props.row)"
5757
)
58+
q-tooltip.text-body2(anchor="top middle" self="bottom middle")
59+
span(v-text="getHibpTooltip(props.row)")
5860
span.text-caption.text-grey-7(v-if="props.row?.hibpLastCheckAt")
5961
| ({{ $dayjs(props.row.hibpLastCheckAt).format('DD/MM/YYYY HH:mm').toString() }})
6062
</template>
@@ -172,6 +174,26 @@ export default defineNuxtComponent({
172174
}
173175
return 'grey-7'
174176
},
177+
getHibpTooltip(row: any): string {
178+
// `hibpPwnCount` est le nombre d'occurrences retourné par l'API HIBP "Pwned Passwords".
179+
// Plus le nombre est élevé, plus le mot de passe est commun/compromis.
180+
if (row?.hasHibpFingerprint === false) {
181+
return "Empreinte HIBP non stockée au moment de l'enregistrement du mot de passe, le re-check n'est pas possible pour cette entrée."
182+
}
183+
184+
if (!row?.hibpLastCheckAt) {
185+
return "En attente de vérification HIBP (re-check planifié)."
186+
}
187+
188+
if (typeof row?.hibpPwnCount === 'number') {
189+
if (row.hibpPwnCount > 0) {
190+
return `Compromis : ce mot de passe apparaît ${row.hibpPwnCount} fois dans la base HIBP (Pwned Passwords).`
191+
}
192+
return 'OK : ce mot de passe n’apparaît pas dans la base HIBP (Pwned Passwords).'
193+
}
194+
195+
return 'Vérifié (résultat non disponible).'
196+
},
175197
async fetchHistory() {
176198
const loadingStartedAt = Date.now()
177199
this.loading = true

0 commit comments

Comments
 (0)