Skip to content

Commit

Permalink
fix: ensure pppoe iface name has a max of 5 chars (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
andre8244 authored Oct 3, 2024
1 parent de5cb97 commit 898bc85
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion public/i18n/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,8 @@
"create_bond": "Create bond",
"configure_bond": "Configure bond",
"configure_bond_name": "Configure bond {name}",
"clients_network": "Clients network"
"clients_network": "Clients network",
"pppoe_name_too_long_need_reconfiguration": "PPPoE interface names are limited to {num} characters. You can remove the configuration from this device, then reconfigure it with a shorter interface name."
},
"multi_wan": {
"title": "MultiWAN",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,9 @@ function validate() {
if (logicalIfaceType.value == 'bond') {
maxLen = 10
}
if (protocol.value == 'pppoe') {
maxLen = 5
}
let { valid, errMessage, i18Params } = validateUciName(interfaceName.value, maxLen)
if (!valid) {
error.value.interfaceName = t(errMessage as string, i18Params as any)
Expand All @@ -665,6 +668,20 @@ function validate() {
focusElement(interfaceNameRef)
}
}
} else {
// editing an already configured device
if (protocol.value == 'pppoe' && interfaceName.value.length > 5) {
error.value.interfaceName = t(
'standalone.interfaces_and_devices.pppoe_name_too_long_need_reconfiguration',
{
num: 5
}
)
if (isValidationOk) {
isValidationOk = false
focusElement(interfaceNameRef)
}
}
}
if (isConfiguringFromScratch.value) {
Expand Down

0 comments on commit 898bc85

Please sign in to comment.