validate

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

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

View Source
const BcryptCost = 12

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

CheckPasswordHash compares a plain password with a bcrypt hash, queued the same way as HashPassword.

func HashPassword

func HashPassword(password string) (string, error)

HashPassword returns a bcrypt hash. At most two hashes run at once; further callers queue instead of starving the machine.

func IsSpecialChar

func IsSpecialChar(r rune) bool

func IsValidEmail

func IsValidEmail(email string) bool

func IsValidUsername

func IsValidUsername(username string) bool

IsValidUsername allows letters, numbers, underscores and hyphens.

func PasswordStrengthErrors

func PasswordStrengthErrors(password string) []string

PasswordStrengthErrors returns the i18n keys of the unmet requirements.

func PasswordsMatch

func PasswordsMatch(p1, p2 string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL