Skip to content

Commit

Permalink
Merge pull request #2356 from dusk-network/feature-2355
Browse files Browse the repository at this point in the history
web-wallet: Restrict mnemonic step input to alphabetical characters (Restore Flow)
  • Loading branch information
nortonandreev authored Sep 12, 2024
2 parents 8dbdd84 + d192ec4 commit d7c1f4c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions web-wallet/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Restrict mnemonic step input to alphabetical characters (Restore Flow) [#2355]
- Newly created Wallet does not sync from genesis [#1567]
- Update font-display to swap for custom fonts to improve performance [#2026]
- Update anchor colors to ensure better accessibility [#1765]
Expand Down Expand Up @@ -255,6 +256,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#2014]: https://github.com/dusk-network/rusk/issues/2014
[#2303]: https://github.com/dusk-network/rusk/issues/2303
[#2310]: https://github.com/dusk-network/rusk/issues/2310
[#2355]: https://github.com/dusk-network/rusk/issues/2355

<!-- VERSIONS -->

Expand Down
18 changes: 16 additions & 2 deletions web-wallet/src/lib/dusk/components/Mnemonic/Mnemonic.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,25 @@
}
/**
* Adds word to the entered phrase if only one suggestion is available
* @param {{ key: string }} event
* Prevents non-alphabetical characters from being entered
* and auto-selects the first suggestion on Enter
* if there is only one word available
* @param {KeyboardEvent} event
* @param {string} index
*/
function handleKeyDownOnAuthenticateTextbox(event, index) {
const isAlphabetical = /^[a-zA-Z]+$/;
if (!isAlphabetical.test(event.key)) {
event.preventDefault();
toast(
"error",
"Only alphabetical characters are allowed",
mdiAlertOutline
);
return;
}
if (event.key === "Enter" && suggestions.length === 1) {
updateEnteredPhrase(suggestions[0], index);
}
Expand Down

0 comments on commit d7c1f4c

Please sign in to comment.