authelia/internal/utils/const.go
James Elliott a92b0bff1d
[FEATURE] Plain Text Email Notifications (#1238)
* add a plain text email template
* use plain text email template for file based emails
* add config option to SMTP emails named disable_html_emails
  * config option is a boolean that when set to true will only send plain text emails
* add docs for more complex SMTP notifier options
* update template
* add rfc1341 multipart logic to notifier
* check for errors after identity_verification

* * fix nil ptr
* go mod tidy
* remove needless checks

* * use multipart/atlernative instead

* * add rfc5322 compliant date header

* * fix linting issues
2020-08-21 12:16:23 +10:00

35 lines
987 B
Go

package utils
import (
"errors"
"regexp"
"time"
)
// ErrTimeoutReached error thrown when a timeout is reached.
var ErrTimeoutReached = errors.New("timeout reached")
var parseDurationRegexp = regexp.MustCompile(`^(?P<Duration>[1-9]\d*?)(?P<Unit>[smhdwMy])?$`)
// Hour is an int based representation of the time unit.
const Hour = time.Minute * 60
// Day is an int based representation of the time unit.
const Day = Hour * 24
// Week is an int based representation of the time unit.
const Week = Day * 7
// Year is an int based representation of the time unit.
const Year = Day * 365
// Month is an int based representation of the time unit.
const Month = Year / 12
// RFC3339Zero is the default value for time.Time.Unix().
const RFC3339Zero = int64(-62135596800)
const testStringInput = "abcdefghijkl"
// AlphaNumericCharacters are literally just valid alphanumeric chars.
var AlphaNumericCharacters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")