Documentation ¶
Overview ¶
Package lock implements user locking after N bad sign-in attempts.
Index ¶
- Constants
- func IsLocked(lu authboss.LockableUser) bool
- func Middleware(ab *authboss.Authboss) func(http.Handler) http.Handler
- type Lock
- func (l *Lock) AfterAuthFail(w http.ResponseWriter, r *http.Request, handled bool) (bool, error)
- func (l *Lock) AfterAuthSuccess(w http.ResponseWriter, r *http.Request, handled bool) (bool, error)
- func (l *Lock) BeforeAuth(w http.ResponseWriter, r *http.Request, handled bool) (bool, error)
- func (l *Lock) Init(ab *authboss.Authboss) error
- func (l *Lock) Lock(ctx context.Context, key string) error
- func (l *Lock) Unlock(ctx context.Context, key string) error
Constants ¶
View Source
const ( StoreAttemptNumber = "attempt_number" StoreAttemptTime = "attempt_time" StoreLocked = "locked" )
Storage key constants
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
Middleware ensures that a user is not locked, or else it will intercept the request and send them to the configured LockNotOK page, this will load the user if he's not been loaded yet from the session. And panics if it cannot load the user.
Types ¶
type Lock ¶
Lock module
func (*Lock) AfterAuthFail ¶
AfterAuthFail adjusts the attempt number and time negatively and locks the user if they're beyond limits.
func (*Lock) AfterAuthSuccess ¶
AfterAuthSuccess resets the attempt number field.
func (*Lock) BeforeAuth ¶
BeforeAuth ensures the account is not locked.
Click to show internal directories.
Click to hide internal directories.