aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorBobby <[email protected]>2026-03-08 04:00:38 +0530
committerBobby <[email protected]>2026-03-08 04:00:38 +0530
commit44e056c26936b302478fa4e64e3f8e3e6a9a30cf (patch)
tree15546500b74b10fcb741727440666f2f5167c174 /utils
parentcaf265e7050edefa64ecf7e13828ec9636bce867 (diff)
downloaddove-44e056c26936b302478fa4e64e3f8e3e6a9a30cf.tar.xz
dove-44e056c26936b302478fa4e64e3f8e3e6a9a30cf.zip
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.
Diffstat (limited to 'utils')
-rw-r--r--utils/validate/names.go14
1 files changed, 14 insertions, 0 deletions
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)
+}