Documentation
¶
Index ¶
- Constants
- func ApiPasswordRestore(w http.ResponseWriter, r *http.Request, deps dependencies)
- func ApiPasswordRestoreWithAuth(w http.ResponseWriter, r *http.Request, a types.AuthSharedInterface)
- func NewDependencies(...) (dependencies, error)
- type PasswordRestoreError
- type PasswordRestoreErrorCode
- type PasswordRestoreResult
Constants ¶
const ERROR_EMAIL_INVALID = "Email is invalid"
const ERROR_EMAIL_REQUIRED = "Email is required field"
const ERROR_FIRST_NAME_REQUIRED = "First name is required field"
const ERROR_INTERNAL_SERVER = "Internal server error. Please try again later"
const ERROR_LAST_NAME_REQUIRED = "Last name is required field"
const ERROR_USER_NOT_FOUND = "User not found"
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.