49 lines
1.6 KiB
Go
49 lines
1.6 KiB
Go
//go:build mysql
|
|
// +build mysql
|
|
|
|
package mysql
|
|
|
|
import (
|
|
"time"
|
|
|
|
t "github.com/tinode/chat/server/store/types"
|
|
)
|
|
|
|
// Login lockout counters are runtime security state and are stored in Redis by
|
|
// the store layer. The MySQL adapter keeps these methods only to satisfy older
|
|
// adapter interfaces while preventing accidental writes to im_login_lockouts.
|
|
func (a *adapter) TenantLoginLockoutGet(id t.TenantID, accountHash string) (*t.LoginLockout, error) {
|
|
if err := validTenant(id); err != nil || accountHash == "" {
|
|
return nil, t.ErrMalformed
|
|
}
|
|
return nil, t.ErrUnsupported
|
|
}
|
|
|
|
func (a *adapter) TenantLoginLockoutRecordFailure(id t.TenantID, accountHash string, userID *int64, windowCutoff, now time.Time) (*t.LoginLockout, error) {
|
|
if err := validTenant(id); err != nil || accountHash == "" || now.IsZero() {
|
|
return nil, t.ErrMalformed
|
|
}
|
|
return nil, t.ErrUnsupported
|
|
}
|
|
|
|
func (a *adapter) TenantLoginLockoutLock(id t.TenantID, accountHash string, lockedUntil, now time.Time) error {
|
|
if err := validTenant(id); err != nil || accountHash == "" || lockedUntil.IsZero() || now.IsZero() {
|
|
return t.ErrMalformed
|
|
}
|
|
return t.ErrUnsupported
|
|
}
|
|
|
|
func (a *adapter) TenantLoginLockoutReset(id t.TenantID, accountHash string) error {
|
|
if err := validTenant(id); err != nil || accountHash == "" {
|
|
return t.ErrMalformed
|
|
}
|
|
return t.ErrUnsupported
|
|
}
|
|
|
|
func (a *adapter) TenantLoginLockoutRelease(id t.TenantID, accountHash string, now time.Time) error {
|
|
if err := validTenant(id); err != nil || accountHash == "" || now.IsZero() {
|
|
return t.ErrMalformed
|
|
}
|
|
return t.ErrUnsupported
|
|
}
|