Forbid the separator in the sub-addr name

This commit is contained in:
Rodolphe Bréard 2023-09-25 11:30:08 +02:00
parent f45c77ba64
commit 1c8d6db391
2 changed files with 15 additions and 9 deletions

View file

@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- The style has been entirely reworked using Bootstrap instead of Bulma
- It is now impossible to include the separator in the dedicated name
## [0.3.0] - 2023-08-25

View file

@ -29,6 +29,10 @@ const generatedAddr = computed(() => {
const raw_account = accounts.value.find((e) => e.id == selectedAccountId.value);
if (raw_account) {
const account = fromRawAccount(raw_account);
if (subAddrName.value.indexOf(account.separator) != -1) {
subAddrName.value = subAddrName.value.replaceAll(account.separator, '');
}
if (subAddrName.value) {
var hasher = hmac.create(sha256, account.key);
hasher.update(account.localPart);
hasher.update(account.separator);
@ -40,6 +44,7 @@ const generatedAddr = computed(() => {
return `${account.localPart}${account.separator}${subAddrName.value}${account.separator}${code}@${account.domain}`;
}
}
}
return '';
});
const copyAddr = () => {