diff options
| author | Bobby <[email protected]> | 2026-03-08 03:06:23 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2026-03-08 03:06:23 +0530 |
| commit | caf265e7050edefa64ecf7e13828ec9636bce867 (patch) | |
| tree | 6bb8554dbb34695a74c2dca556bf512998cf62ab /session | |
| parent | cca905d35412f1549400fc3d1aca6dc704d8cae6 (diff) | |
| download | dove-caf265e7050edefa64ecf7e13828ec9636bce867.tar.xz dove-caf265e7050edefa64ecf7e13828ec9636bce867.zip | |
Refactor configuration handling and add mail management features
- Removed dependency on messages package in TOML loading and parsing.
- Introduced new config constants and messages for better clarity and maintainability.
- Implemented mail user and mailbox management with corresponding controllers and views.
- Added new templates for mailboxes, mailbox creation, and user management.
- Enhanced logging and error handling throughout the application.
- Established a structured approach for applying default values in TOML configuration.
- Created new utility functions for SMTP and email handling.
Diffstat (limited to 'session')
| -rw-r--r-- | session/constants.go | 10 | ||||
| -rw-r--r-- | session/defaults.go | 10 | ||||
| -rw-r--r-- | session/messages.go | 5 | ||||
| -rw-r--r-- | session/session.go | 9 |
4 files changed, 19 insertions, 15 deletions
diff --git a/session/constants.go b/session/constants.go deleted file mode 100644 index d6a7f69..0000000 --- a/session/constants.go +++ /dev/null @@ -1,10 +0,0 @@ -package session - -import "time" - -const ( - LOG_PREFIX = "Session" - SESSION_COOKIE_NAME = "dove_session" - SESSION_COOKIE_SAME_SITE = "Lax" - SESSION_EXPIRATION = 24 * time.Hour -) diff --git a/session/defaults.go b/session/defaults.go new file mode 100644 index 0000000..c88c75a --- /dev/null +++ b/session/defaults.go @@ -0,0 +1,10 @@ +package session + +import "time" + +const ( + CookieName = "dove_session" + CookieSameSite = "Lax" + Expiration = 24 * time.Hour + LogPrefix = "Session" +) diff --git a/session/messages.go b/session/messages.go new file mode 100644 index 0000000..018d913 --- /dev/null +++ b/session/messages.go @@ -0,0 +1,5 @@ +package session + +const ( + Initialized = "Session store initialized." +) diff --git a/session/session.go b/session/session.go index 89b7ef8..de74832 100644 --- a/session/session.go +++ b/session/session.go @@ -3,7 +3,6 @@ package session import ( "fmt" - "dove/messages" "dove/utils/logger" "github.com/gofiber/fiber/v2/middleware/session" @@ -13,11 +12,11 @@ var Store *session.Store func init() { Store = session.New(session.Config{ - KeyLookup: fmt.Sprintf("cookie:%s", SESSION_COOKIE_NAME), + KeyLookup: fmt.Sprintf("cookie:%s", CookieName), CookieHTTPOnly: true, - CookieSameSite: SESSION_COOKIE_SAME_SITE, - Expiration: SESSION_EXPIRATION, + CookieSameSite: CookieSameSite, + Expiration: Expiration, }) - logger.Successf(LOG_PREFIX, messages.SessionInitialized) + logger.Successf(LogPrefix, Initialized) } |
