Documentation
¶
Overview ¶
Package validate holds the input checks and password hashing shared by the CSuit apps: email and username format, password strength rules, and a bcrypt wrapper that limits how many hashes run at once.
Index ¶
- Constants
- func CheckPasswordHash(password, hash string) bool
- func HashPassword(password string) (string, error)
- func IsSpecialChar(r rune) bool
- func IsValidEmail(email string) bool
- func IsValidUsername(username string) bool
- func PasswordStrengthErrors(password string) []string
- func PasswordsMatch(p1, p2 string) bool
Constants ¶
View Source
const BcryptCost = 12
Variables ¶
This section is empty.
Functions ¶
func CheckPasswordHash ¶
CheckPasswordHash compares a plain password with a bcrypt hash, queued the same way as HashPassword.
func HashPassword ¶
HashPassword returns a bcrypt hash. At most two hashes run at once; further callers queue instead of starving the machine.
func IsSpecialChar ¶
func IsValidEmail ¶
func IsValidUsername ¶
IsValidUsername allows letters, numbers, underscores and hyphens.
func PasswordStrengthErrors ¶
PasswordStrengthErrors returns the i18n keys of the unmet requirements.
func PasswordsMatch ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.