api_password_restore

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApiPasswordRestore

func ApiPasswordRestore(w http.ResponseWriter, r *http.Request, deps dependencies)

ApiPasswordRestore is the HTTP-level helper that wires request/response handling to the core PasswordRestore business logic using the provided dependencies.

func ApiPasswordRestoreWithAuth

func ApiPasswordRestoreWithAuth(w http.ResponseWriter, r *http.Request, a types.AuthSharedInterface)

ApiPasswordRestoreWithAuth is a convenience wrapper that allows callers to pass a types.AuthSharedInterface (such as authImplementation) instead of manually wiring dependencies. It constructs the dependencies struct using the interface accessors and preserves the existing behaviour.

func NewDependencies

func NewDependencies(
	userFindByUsername func(ctx context.Context, email, firstName, lastName string) (userID string, err error),
	temporaryKeySet func(key string, value string, expiresSeconds int) error,
	expiresSeconds int,
	emailTemplate func(ctx context.Context, userID, token string) string,
	emailSend func(ctx context.Context, userID, subject, body string) error,
	logger *slog.Logger,
) (dependencies, error)

NewDependencies validates that all required dependencies are provided and returns a fully-initialized private dependencies value or an error.

Types

type PasswordRestoreError

type PasswordRestoreError struct {
	Code      PasswordRestoreErrorCode
	Message   string
	Err       error
	UserID    string
	Email     string
	FirstName string
	LastName  string
}

PasswordRestoreError represents a structured error for password restore.

func (*PasswordRestoreError) Error

func (e *PasswordRestoreError) Error() string

type PasswordRestoreErrorCode

type PasswordRestoreErrorCode string

PasswordRestoreErrorCode categorizes error sources in the password restore flow.

type PasswordRestoreResult

type PasswordRestoreResult struct {
	SuccessMessage string
}

PasswordRestoreResult represents a successful password restore operation.

Jump to

Keyboard shortcuts

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