From 44e056c26936b302478fa4e64e3f8e3e6a9a30cf Mon Sep 17 00:00:00 2001 From: Bobby Date: Sun, 8 Mar 2026 04:00:38 +0530 Subject: feat: Enhance mail and domain management UI and functionality - Updated users page to include a help link with an icon. - Refactored sidebar navigation to improve organization and added collapsible sections for Domains and Mail. - Created new pages for managing domains and TLDs, including a detailed description of the Domain Manager. - Implemented confirmation modals for deleting TLDs with appropriate messaging. - Added JavaScript functionality for sidebar state management and confirmation modals. - Introduced new Go handlers for mail index and domain management. - Added validation functions for DNS labels and email local parts. --- utils/validate/names.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 utils/validate/names.go (limited to 'utils') diff --git a/utils/validate/names.go b/utils/validate/names.go new file mode 100644 index 0000000..0d0fd25 --- /dev/null +++ b/utils/validate/names.go @@ -0,0 +1,14 @@ +package validate + +import "regexp" + +var dnsLabelPattern = regexp.MustCompile(`^[a-z0-9]([a-z0-9-]*[a-z0-9])?$`) +var emailLocalPartPattern = regexp.MustCompile(`^[a-z0-9]([a-z0-9._-]*[a-z0-9])?$`) + +func DNSLabel(name string) bool { + return len(name) >= 1 && len(name) <= 63 && dnsLabelPattern.MatchString(name) +} + +func EmailLocalPart(localPart string) bool { + return len(localPart) >= 1 && len(localPart) <= 64 && emailLocalPartPattern.MatchString(localPart) +} -- cgit v1.2.3