auth

package
v0.0.0-...-990eb5e Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 23 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")
	ErrInvalidOrExpiredResetURL = errors.New("Invalid or expired reset URL")
)

Functions

func RegisterRoutes

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

Types

type BindValidator

type BindValidator interface {
	Binder
	Validator
}

type Binder

type Binder interface {
	Bind(r *http.Request) error
}

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) ForgotPasswordView

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

func (*Handler) ResendOTP

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

func (*Handler) ResetPassword

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

func (*Handler) ResetPasswordView

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

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) SignupConfirmation

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

func (*Handler) SignupView

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

type ResendOTPForm

type ResendOTPForm struct {
	Email string
}

func (*ResendOTPForm) Bind

func (f *ResendOTPForm) Bind(r *http.Request) error

func (*ResendOTPForm) Validate

func (f *ResendOTPForm) Validate() error

type ResetPasswordForm

type ResetPasswordForm struct {
	Password        string
	ConfirmPassword string
	Token           string
}

func (*ResetPasswordForm) Bind

func (f *ResetPasswordForm) Bind(r *http.Request) error

func (*ResetPasswordForm) Validate

func (f *ResetPasswordForm) Validate() error

type SendResetPasswordLinkForm

type SendResetPasswordLinkForm struct {
	Email string
}

func (*SendResetPasswordLinkForm) Bind

func (*SendResetPasswordLinkForm) Validate

func (f *SendResetPasswordLinkForm) Validate() error

type SigninForm

type SigninForm struct {
	Email    string
	Password string
}

func (*SigninForm) Bind

func (f *SigninForm) Bind(r *http.Request) error

func (*SigninForm) Validate

func (f *SigninForm) Validate() error

type SignupConfirmationForm

type SignupConfirmationForm struct {
	OTP   string
	Email string
}

func (*SignupConfirmationForm) Bind

func (*SignupConfirmationForm) Validate

func (f *SignupConfirmationForm) Validate() error

type SignupForm

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

func (*SignupForm) Bind

func (f *SignupForm) Bind(r *http.Request) error

func (*SignupForm) Validate

func (f *SignupForm) Validate() error

type Validator

type Validator interface {
	Validate() error
}

Jump to

Keyboard shortcuts

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