Documentation ¶
Index ¶
- Variables
- func NewMemoryStore() *crud.MemoryStore[NewPasswordRecovery, PasswordRecovery, FindFilters]
- func Router(service *Service) func(chi.Router)
- type Config
- type FindFilters
- type Mailer
- type NewPasswordRecovery
- type PasswordRecovery
- type RecoveryRequest
- type Service
- type SetPasswordRequest
- type SqlStore
- func (s *SqlStore) Create(ctx context.Context, newPasswordRecovery *NewPasswordRecovery) (*PasswordRecovery, error)
- func (s *SqlStore) Delete(ctx context.Context, id string) error
- func (s *SqlStore) Find(ctx context.Context, params *crud.FindParams[FindFilters]) ([]*PasswordRecovery, int, error)
- func (s *SqlStore) FindByID(ctx context.Context, id string) (*PasswordRecovery, error)
- func (s *SqlStore) RunMigrations(ctx context.Context) error
- func (s *SqlStore) Update(ctx context.Context, passwordrec *PasswordRecovery) (*PasswordRecovery, error)
- type Storer
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrExpiredRecoveryToken = xerror.BadInputError{Err: fmt.Errorf("expired recovery token")}
View Source
var ErrInvalidRecoveryToken = xerror.BadInputError{Err: fmt.Errorf("invalid recovery token")}
Functions ¶
func NewMemoryStore ¶
func NewMemoryStore() *crud.MemoryStore[NewPasswordRecovery, PasswordRecovery, FindFilters]
NewMemoryStore returns a new in memory store.
Types ¶
type FindFilters ¶
type FindFilters struct { ID *string UserID *string Email *string Token *string RequestedAt *time.Time }
FindFilters defines the possible filters for the find method.
type NewPasswordRecovery ¶
type NewPasswordRecovery struct { UserID string `json:"user_id"` Email string `json:"email"` Token string `json:"token"` RequestedAt time.Time `json:"requested_at"` }
NewPasswordRecovery is the model used to create new password recoveries.
type PasswordRecovery ¶
type PasswordRecovery struct { ID string `json:"id" db:"id"` UserID string `json:"user_id" db:"user_id"` Email string `json:"email" db:"email"` Token string `json:"token" db:"token"` RequestedAt time.Time `json:"requested_at" db:"requested_at"` }
PasswordRecovery is the password recovery model.
func PasswordRecoveryFromNewPasswordRecovery ¶
func PasswordRecoveryFromNewPasswordRecovery(newPasswordRecvoery *NewPasswordRecovery, id string) *PasswordRecovery
InvitationFromNewInvitation converts a NewInvitation to an Invitation with a given id.
func (PasswordRecovery) Identifier ¶
func (p PasswordRecovery) Identifier() string
type RecoveryRequest ¶
type RecoveryRequest struct {
Email string `json:"email"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(mailService Mailer, userService user.Storer, engine *template.Engine, store Storer, baseURL string) *Service
NewService returns a new recovery service.
func (*Service) RequestRecovery ¶
type SetPasswordRequest ¶
type SqlStore ¶
type SqlStore struct {
// contains filtered or unexported fields
}
func NewSqlStore ¶
NewSqlStore returns a new sql db passwordrec store.
func (*SqlStore) Create ¶
func (s *SqlStore) Create(ctx context.Context, newPasswordRecovery *NewPasswordRecovery) (*PasswordRecovery, error)
func (*SqlStore) Find ¶
func (s *SqlStore) Find(ctx context.Context, params *crud.FindParams[FindFilters]) ([]*PasswordRecovery, int, error)
func (*SqlStore) Update ¶
func (s *SqlStore) Update(ctx context.Context, passwordrec *PasswordRecovery) (*PasswordRecovery, error)
type Storer ¶
type Storer crud.Storer[NewPasswordRecovery, PasswordRecovery, FindFilters]
Storer defines an interface for accessing the PasswordRecovery model.
Click to show internal directories.
Click to hide internal directories.