Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions openwisp_controller/config/base/vpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -892,12 +892,12 @@ def _get_common_name(self):
"""
d = self.config.device
end = 63 - len(d.mac_address)
d.name = d.name[:end]
name = d.name[:end]
unique_slug = shortuuid.ShortUUID().random(length=8)
cn_format = app_settings.COMMON_NAME_FORMAT
if cn_format == "{mac_address}-{name}" and d.name == d.mac_address:
if cn_format == "{mac_address}-{name}" and name == d.mac_address:
cn_format = "{mac_address}"
common_name = cn_format.format(**d.__dict__)[:55]
common_name = cn_format.format(**{**d.__dict__, "name": name})[:55]
common_name = f"{common_name}-{unique_slug}"
return common_name

Expand Down
Loading