Documentation ¶
Index ¶
- Variables
- func NewAuthService(config ServiceConfig) anor.AuthService
- func RegisterRoutes(h *Handler, router *anor.Router)
- type Handler
- func (h *Handler) ForgotPasswordView(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GoogleCallback(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GoogleSignin(w http.ResponseWriter, r *http.Request)
- func (h *Handler) RedirectAuth(next http.Handler) http.Handler
- func (h *Handler) Render(w http.ResponseWriter, r *http.Request, templatePath string, ...)
- func (h *Handler) ResendOTP(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ResetPassword(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ResetPasswordView(w http.ResponseWriter, r *http.Request)
- func (h *Handler) SendResetPasswordLink(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Signin(w http.ResponseWriter, r *http.Request)
- func (h *Handler) SigninView(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Signup(w http.ResponseWriter, r *http.Request)
- func (h *Handler) SignupConfirmation(w http.ResponseWriter, r *http.Request)
- func (h *Handler) SignupView(w http.ResponseWriter, r *http.Request)
- type HandlerConfig
- type OTPGenerator
- type ResendOTPForm
- type ResetPasswordForm
- type SendResetPasswordLinkForm
- type ServiceConfig
- type SigninForm
- type SignupConfirmationForm
- type SignupForm
- type TokenGenerator
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") ErrEmailNotConfirmed = errors.New("email not confirmed") ErrAccountBlocked = errors.New("account blocked") ErrInvalidOrExpiredResetURL = errors.New("invalid or expired reset URL") ErrOAuth2RegisteredAccount = errors.New("OAuth2 registered account") )
Functions ¶
func NewAuthService ¶
func NewAuthService(config ServiceConfig) anor.AuthService
func RegisterRoutes ¶
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(cfg *HandlerConfig) *Handler
func (*Handler) ForgotPasswordView ¶
func (h *Handler) ForgotPasswordView(w http.ResponseWriter, r *http.Request)
func (*Handler) GoogleCallback ¶
func (h *Handler) GoogleCallback(w http.ResponseWriter, r *http.Request)
func (*Handler) GoogleSignin ¶
func (h *Handler) GoogleSignin(w http.ResponseWriter, r *http.Request)
func (*Handler) Render ¶
func (h *Handler) Render(w http.ResponseWriter, r *http.Request, templatePath string, td templates.TemplateData)
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 (*Handler) SendResetPasswordLink ¶
func (h *Handler) SendResetPasswordLink(w http.ResponseWriter, r *http.Request)
func (*Handler) SigninView ¶
func (h *Handler) SigninView(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 HandlerConfig ¶
type HandlerConfig struct { AuthService anor.AuthService CartService anor.CartService Session *session.Manager View *html.View Logger *slog.Logger }
type OTPGenerator ¶
type OTPGenerator func() string
type ResendOTPForm ¶
type ResendOTPForm struct {
Email string
}
func (*ResendOTPForm) Validate ¶
func (f *ResendOTPForm) Validate() error
type ResetPasswordForm ¶
func (*ResetPasswordForm) Validate ¶
func (f *ResetPasswordForm) Validate() error
type SendResetPasswordLinkForm ¶
type SendResetPasswordLinkForm struct {
Email string
}
func (*SendResetPasswordLinkForm) Bind ¶
func (f *SendResetPasswordLinkForm) Bind(r *http.Request) error
func (*SendResetPasswordLinkForm) Validate ¶
func (f *SendResetPasswordLinkForm) Validate() error
type ServiceConfig ¶
type ServiceConfig struct { UserService anor.UserService Emailer email.Emailer SignupConfirmationOTPCacher auth.SignupConfirmationOTPCache ResetPasswordTokenCacher auth.ResetPasswordTokenCache OTPGenerator OTPGenerator OTPExpiration time.Duration TokenGenerator TokenGenerator TokenExpiration time.Duration ServerURL string }
type SigninForm ¶
func (*SigninForm) Validate ¶
func (f *SigninForm) Validate() error
type SignupConfirmationForm ¶
func (*SignupConfirmationForm) Validate ¶
func (f *SignupConfirmationForm) Validate() error
type SignupForm ¶
func (*SignupForm) Validate ¶
func (f *SignupForm) Validate() error
type TokenGenerator ¶
type TokenGenerator func() string
Source Files ¶
- errors.go
- handle_forgot_password_view.go
- handle_google_callback.go
- handle_google_signin.go
- handle_resend_otp.go
- handle_reset_password.go
- handle_reset_password_view.go
- handle_send_reset_password_link.go
- handle_signin.go
- handle_signin_view.go
- handle_signup.go
- handle_signup_confirmation.go
- handle_signup_view.go
- handler.go
- middlewares.go
- routes.go
- service.go
Click to show internal directories.
Click to hide internal directories.