user

package
v0.0.0-...-cf730da Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UsernameMinLength = 3
	UsernameMaxLength = 255
	PasswordMinLength = 8
)

Variables

View Source
var (
	//errors
	ErrPasswordConfirmationDoesNotMatch = errors.Validation(
		errors.FromString("Password confirmation doesn't match."))

	ErrUsernameAlreadyTaken = errors.Conflict(errors.FromString("Username already taken"))
	ErrUsernameWrongLength  = errors.Validation(fmt.Errorf(
		"Username length is valid, mininum is %d and maximum is %d",
		UsernameMinLength,
		UsernameMaxLength,
	))
	ErrPasswordTooShort = errors.Validation(
		fmt.Errorf("Passord must be longer than %d characters", PasswordMinLength))
	ErrUsernameHasInvalidCharacters = errors.Validation(
		errors.FromString("Username can only contain alphanumeric characters and underscores."))
)

Functions

func New

func New(db *sql.DB, bCryptCost int) *model

func Validate

func Validate(username, password, passwordConfirmation string) errors.Error

Types

This section is empty.

Jump to

Keyboard shortcuts

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