Skip to content

Commit

Permalink
fix: code style
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandez14 committed Jun 14, 2024
1 parent e1c96e4 commit e201977
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/security/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ func (module Module) TrustUserIP(address string, usr *user.One) bool {
return err != nil && !user.Banned
}

if ip.Banned == true && user.Banned == true {
if ip.Banned && user.Banned {
return false
} else if ip.Banned == false && user.Banned == true {
} else if !ip.Banned && user.Banned {

// In case the ip is not banned but the user is then update it
err = mgo.C("trusted_addresses").Update(
Expand All @@ -49,7 +49,7 @@ func (module Module) TrustUserIP(address string, usr *user.One) bool {
panic(err)
}
return false
} else if ip.Banned == true && user.Banned == false {
} else if ip.Banned && !user.Banned {

// In case the ip is banned but the user is not then update it
err = mgo.C("users").Update(bson.M{"_id": user.Id}, bson.M{"$set": bson.M{"banned": true, "banned_at": time.Now()}, "$push": bson.M{"banned_reason": user.UserName + " has accessed from a flagged IP. " + ip.Address}})
Expand All @@ -71,7 +71,7 @@ func (module Module) TrustIP(address string) bool {
return true
}

if ip.Banned == true {
if ip.Banned {
return false
}

Expand Down

0 comments on commit e201977

Please sign in to comment.