ux

package
v0.0.0-...-41f164b Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SayEmailInvalid     = "Email invalid."
	SayUsernameShort    = "Username is too short."
	SayEnterUserOrEmail = "Enter a username or email."
	SayPasswordInvalid  = "Password is invalid."
	SayPasswordNoMatch  = "Passwords do not match."
	SayEmailTaken       = "Email is taken."
	SayUsernameTaken    = "Username is taken."
	SayBadLogin         = "Incorrect password or account does not exist"
	SayParseForm        = "internal Server Error - 13481"
	SayAuthStateNil     = "internal Server Error - 13483"
	SayHashPassword     = "internal Server Error - 19283"
	SayDbInsertUser     = "internal Server Error - 12405"
	SayReflect          = "internal Server Error - 12405"
)

User-facing messages

Functions

This section is empty.

Types

type AuthError

type AuthError struct {
	Location string
	Say      string
	Err      error
}

type AuthResult

type AuthResult struct {
	Errs []AuthError
	User User
}

func SignIn

func SignIn(a PSignIn) AuthResult

func SignUp

func SignUp(a PSignUp) AuthResult

The caller is required to do the Insert to their database.

type DbAccessor

type DbAccessor interface {
	SelectUserById(ctx context.Context, id string) (interface{}, error)
	SelectUserByEmail(ctx context.Context, email string) (interface{}, error)
	SelectUserByEmailWithPassword(ctx context.Context, email string) (interface{}, error)
	SelectUserByUsername(ctx context.Context, username string) (interface{}, error)
	SelectUserByUsernameWithPassword(ctx context.Context, username string) (interface{}, error)
}

type PSignIn

type PSignIn struct {
	UserOrEmail string
	Password    string
	Db          DbAccessor
}

type PSignUp

type PSignUp struct {
	Email      string
	Username   string
	Password   string
	PassConf   string
	AuthConfig lib.Config
	Db         DbAccessor
}

type User

type User struct {
	ID                string
	Email             string
	Username          string
	PasswordSalt      string
	EncryptedPassword string
	PasswordCreatedAt time.Time
}

func GetUserFields

func GetUserFields(user interface{}) (User, error)

Jump to

Keyboard shortcuts

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