Documentation ¶
Index ¶
- Constants
- Variables
- func BlurEmailAddress(email string) string
- func CheckEmailFormat(email string) bool
- func CheckLanguageCode(code string) bool
- func CheckPasswordFormat(password string) bool
- func GenerateOTPCode(length int) (string, error)
- func GenerateUniqueTokenString() (string, error)
- func GetExpirationTime(validityPeriod time.Duration) time.Time
- func GetMainAndOtherProfiles(user userTypes.User) (mainProfileID string, otherProfileIDs []string)
- func HasMoreAttemptsRecently(attempts []int64, moreThan int, intervalSeconds int64) bool
- func InitNewEmailUser(email string, password string, locale string) userTypes.User
- func InitWeekdayAssignationStrategy(weekdayAssignation map[string]int)
- func InitWeekdayAssignationStrategyFromEnv(envWeekdayAssignation string)
- func IsPasswordOnBlocklist(password string) bool
- func LoadBlockedPasswords(filename string) error
- func ParseWeeklyWeight(str string) ([]int, error)
- func ReachedExpirationTime(t time.Time) bool
- func RemoveAttemptsOlderThan(attempts []int64, olderThanSeconds int64) []int64
- func SanitizeEmail(email string) string
- func SanitizePhoneNumber(phone string) string
- type Interval
- type WeekDayStrategy
- type Weight
Constants ¶
const ( PASSWORD_MIN_LEN = 12 PASSWORD_MAX_LEN = 512 )
Variables ¶
var CurrentWeekdayStrategy = WeekDayStrategy{ // contains filtered or unexported fields }
Functions ¶
func BlurEmailAddress ¶
BlurEmailAddress transforms an email address to reduce exposed personal info
func CheckEmailFormat ¶
CheckEmailFormat to check if input string is a correct email address
func CheckLanguageCode ¶
CheckLanguageCode checks if a string can be considered as a language code
func CheckPasswordFormat ¶
CheckPasswordFormat to check if password fulfills password rules
func GenerateOTPCode ¶
GenerateOTPCode generates a random OTP code of the given length
func GetMainAndOtherProfiles ¶
GetMainAndOtherProfiles extract main profile ID and secondary profiles from a user account info
func HasMoreAttemptsRecently ¶
func InitNewEmailUser ¶
func InitWeekdayAssignationStrategyFromEnv ¶
func InitWeekdayAssignationStrategyFromEnv( envWeekdayAssignation string, )
func IsPasswordOnBlocklist ¶
func LoadBlockedPasswords ¶
func ParseWeeklyWeight ¶
ParseWeeklyWeight parse a string attributing a weight for each day of the week Expected format is a comma separated assignation with [DayName]=Weight with DayName = Mon,Tue,Web,Thu,Frid,Sat,Sun (case insensitive) Weight is a positive integer value or Zero
func ReachedExpirationTime ¶
func RemoveAttemptsOlderThan ¶
func SanitizeEmail ¶
func SanitizePhoneNumber ¶
Types ¶
type WeekDayStrategy ¶
type WeekDayStrategy struct {
// contains filtered or unexported fields
}
func CreateWeekdayDefaultStrategy ¶
func CreateWeekdayDefaultStrategy() WeekDayStrategy
func CreateWeekdayWeightedStrategy ¶
func CreateWeekdayWeightedStrategy(weights []int) WeekDayStrategy
func (*WeekDayStrategy) String ¶
func (s *WeekDayStrategy) String() string
func (*WeekDayStrategy) Weekday ¶
func (s *WeekDayStrategy) Weekday() int
Assign a new weekday using the assignation strategy