auth

package
v0.0.0-...-7f62264 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmailAlreadyTaken  = errors.New("Email already taken")
	ErrInvalidCredentials = errors.New("Invalid credentials")
	ErrInvalidOTP         = errors.New("Invalid OTP")
	ErrExpiredOTP         = errors.New("Expired OTP")
	ErrEmailNotConfirmed  = errors.New("Email not confirmed")
	ErrAccountBlocked     = errors.New("Account blocked")
	ErrAccountInactive    = errors.New("Account inactive")
)

Functions

func NewAuthService

func NewAuthService(us anor.UserService, e emailer.Emailer) anor.AuthService

func RegisterRoutes

func RegisterRoutes(h *Handler, mux *http.ServeMux)

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(
	svc anor.AuthService,
	templ *html.Render,
	session *scs.SessionManager,
	logger *slog.Logger,
) *Handler

func (*Handler) Signin

func (h *Handler) Signin(w http.ResponseWriter, r *http.Request)

func (*Handler) SigninView

func (h *Handler) SigninView(w http.ResponseWriter, r *http.Request)

func (*Handler) Signup

func (h *Handler) Signup(w http.ResponseWriter, r *http.Request)

func (*Handler) SignupConfirm

func (h *Handler) SignupConfirm(w http.ResponseWriter, r *http.Request)

func (*Handler) SignupView

func (h *Handler) SignupView(w http.ResponseWriter, r *http.Request)

type SigninForm

type SigninForm struct {
	Email    string
	Password string
}

type SignupConfirmForm

type SignupConfirmForm struct {
	OTP   string
	Email string
}

type SignupForm

type SignupForm struct {
	Name     string
	Email    string
	Password string
	Confirm  string
}

Jump to

Keyboard shortcuts

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