mirror of
https://github.com/volatiletech/authboss.git
synced 2024-11-24 08:42:17 +02:00
Make lock do what it's supposed to
Inverted the test data, which inverted the logic
This commit is contained in:
parent
1afc6fcb01
commit
5973fa9bd0
@ -163,7 +163,7 @@ func Middleware(ab *authboss.Authboss) func(http.Handler) http.Handler {
|
||||
user := ab.LoadCurrentUserP(&r)
|
||||
|
||||
lu := authboss.MustBeLockable(user)
|
||||
if IsLocked(lu) {
|
||||
if !IsLocked(lu) {
|
||||
next.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ func TestMiddlewareAllow(t *testing.T) {
|
||||
}))
|
||||
|
||||
user := &mocks.User{
|
||||
Locked: time.Now().UTC().Add(time.Hour),
|
||||
Locked: time.Now().UTC().Add(-time.Hour),
|
||||
}
|
||||
|
||||
r := mocks.Request("GET")
|
||||
@ -312,7 +312,7 @@ func TestMiddlewareDisallow(t *testing.T) {
|
||||
}))
|
||||
|
||||
user := &mocks.User{
|
||||
Locked: time.Now().UTC().Add(-time.Hour),
|
||||
Locked: time.Now().UTC().Add(time.Hour),
|
||||
}
|
||||
|
||||
r := mocks.Request("GET")
|
||||
|
Loading…
Reference in New Issue
Block a user