Documentation
¶
Overview ¶
Package passwordreset manages password recovery with emailed tokens.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrAttemptBlocked = errors.New("password reset attempt blocked") ErrConflict = errors.New("password reset conflict") ErrInactiveToken = errors.New("password reset token is inactive") ErrInvalidConfig = errors.New("invalid password reset configuration") ErrInvalidPassword = errors.New("invalid replacement password") ErrInvalidRecord = errors.New("invalid password reset record") ErrInvalidToken = token.ErrInvalidToken ErrNotFound = errors.New("password reset record not found") )
Functions ¶
This section is empty.
Types ¶
type AttemptGuard ¶
type Config ¶
type Config struct {
Lifetime time.Duration
Sender Sender
Passwords Passwords
ValidatePassword PasswordValidator
AttemptGuard AttemptGuard
SecurityEvents SecurityEventSink
NormalizeEmail emailaddress.Normalizer
Now func() time.Time
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
type PasswordValidator ¶
type RequestInput ¶
type ResetInput ¶
type SecurityEvent ¶
type SecurityEventSink ¶
type SecurityEventSink interface {
Record(ctx context.Context, event SecurityEvent)
}
type Store ¶
type Store interface {
FindUserByEmail(ctx context.Context, normalizedEmail string) (User, error)
Issue(ctx context.Context, record Record) error
ResetPassword(
ctx context.Context,
tokenHash TokenHash,
passwordHash string,
resetAt time.Time,
) (User, error)
}
Issue replaces the user's earlier token. ResetPassword accepts the current token once before expiry, changes the password, and invalidates the user's other reset tokens in one storage operation.