autherrors

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Auth errors
	ErrPwdCasingUpper  errs.Error = "password must contain at least one uppercase letter, and at least one lowercase letter"
	ErrPwdCasingLower  errs.Error = "password must contain at least one lowercase letter, and at least one uppercase letter"
	ErrPwdDigits       errs.Error = "password must contain at least one digit, and at least one non-digit"
	ErrPwdSpaces       errs.Error = "password must not contain spaces"
	ErrPwdSpecial      errs.Error = "password must contain at least one special character"
	ErrInvalidLogin    errs.Error = "invalid value, please try again"
	ErrInvalidEmail    errs.Error = "invalid email address"
	ErrInvalidUsername errs.Error = "invalid username"
	ErrUserExists      errs.Error = "user already exists"
	ErrIsActive        errs.Error = "user account is not active"
	ErrPasswordInvalid errs.Error = "invalid password"
	ErrPwdHashMismatch errs.Error = "password is not valid"
	ErrPwdNoMatch      errs.Error = "passwords do not match"
	ErrGenericAuthFail errs.Error = "authentication failed"
	ErrNoSession       errs.Error = "no session found"
)

Variables

This section is empty.

Functions

func Fail

func Fail(code int, msg string, next ...string)

Authentication errors can be raised using autherrors.Fail(...)

This makes sure boilerplate code for failing auth is not repeated.

It also allows for a more consistent way to handle auth errors.

We have a hook setup to catch any authentication errors and redirect to the login page (see hooks.go)

func RegisterHook

func RegisterHook()

Types

This section is empty.

Jump to

Keyboard shortcuts

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