@@ -13,7 +13,11 @@ import BottomSheet from "$lib/ui/BottomSheet/BottomSheet.svelte";
1313import LoadingSheet from " $lib/ui/LoadingSheet/LoadingSheet.svelte" ;
1414import { capitalize } from " $lib/utils" ;
1515import { PERSONAL_BINDING_BY_TYPE_QUERY } from " $lib/utils/personalBinding" ;
16- import { ArrowLeft01Icon } from " @hugeicons/core-free-icons" ;
16+ import {
17+ ArrowLeft01Icon ,
18+ ViewIcon ,
19+ ViewOffIcon ,
20+ } from " @hugeicons/core-free-icons" ;
1721import { HugeiconsIcon } from " @hugeicons/svelte" ;
1822import {
1923 Format ,
@@ -124,6 +128,9 @@ let enameLoading = $state(false);
124128let answerInput = $state (" " );
125129let answerError = $state <string | null >(null );
126130let answerLoading = $state (false );
131+ // The security answer is sensitive — mask it by default, with an eye toggle
132+ // to reveal (spelling matters, so the user needs to be able to check it).
133+ let showAnswer = $state (false );
127134
128135// Question text + envelope id are pulled from the target eVault during
129136// handleSubmitEname. The envelope id is the metaEnvelopeId of the
@@ -1337,17 +1344,35 @@ onMount(() => {
13371344 >
13381345 {securityQuestion } <span class =" text-danger" >*</span >
13391346 </label >
1340- <input
1341- id =" recover-answer"
1342- type =" text"
1343- bind:value ={answerInput }
1344- autocomplete =" off"
1345- autocapitalize =" off"
1346- autocorrect =" off"
1347- spellcheck =" false"
1348- placeholder =" Your answer"
1349- class =" w-full bg-card-alternative rounded-full px-5 py-4 placeholder:text-black-300 outline-none focus:ring-2 focus:ring-primary"
1350- />
1347+ <div class =" relative" >
1348+ <input
1349+ id =" recover-answer"
1350+ type ={showAnswer ? " text" : " password" }
1351+ bind:value ={answerInput }
1352+ autocomplete =" off"
1353+ autocapitalize =" off"
1354+ autocorrect =" off"
1355+ spellcheck =" false"
1356+ placeholder =" Your answer"
1357+ class =" w-full bg-card-alternative rounded-full pl-5 pr-14 py-4 placeholder:text-black-300 outline-none focus:ring-2 focus:ring-primary"
1358+ />
1359+ <button
1360+ type =" button"
1361+ onclick ={() => {
1362+ showAnswer = ! showAnswer ;
1363+ }}
1364+ aria-label ={showAnswer ? " Hide answer" : " Show answer" }
1365+ aria-pressed ={showAnswer }
1366+ class =" absolute inset-y-0 right-0 flex items-center pr-5 text-black-500 active:opacity-70"
1367+ >
1368+ <HugeiconsIcon
1369+ icon ={showAnswer ? ViewOffIcon : ViewIcon }
1370+ size ={20 }
1371+ color =" currentColor"
1372+ strokeWidth ={2 }
1373+ />
1374+ </button >
1375+ </div >
13511376 {#if answerError }
13521377 <p class =" text-danger text-sm font-medium" role =" alert" >
13531378 {answerError }
0 commit comments