1
0
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:
Aaron L 2018-05-07 12:33:58 -07:00
parent 1afc6fcb01
commit 5973fa9bd0
2 changed files with 3 additions and 3 deletions

View File

@ -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
}

View File

@ -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")