diff --git a/occupi-backend/pkg/database/database.go b/occupi-backend/pkg/database/database.go index 99cf0ac9..7f5b711a 100644 --- a/occupi-backend/pkg/database/database.go +++ b/occupi-backend/pkg/database/database.go @@ -877,14 +877,10 @@ func CheckIfUserIsLoggingInFromKnownLocation(ctx *gin.Context, appsession *model return false, nil, err } - logrus.Info("User: ", user) - logrus.Info("Info: ", info) - // Add the user to the cache if cache is not nil cache.SetUser(appsession, user) - for i, location := range user.KnownLocations { - logrus.Info("Location: ", i, location) + for _, location := range user.KnownLocations { if location.Country == info.Country && location.City == info.City && location.Region == info.Region { return true, nil, nil } diff --git a/occupi-backend/pkg/models/database.go b/occupi-backend/pkg/models/database.go index c75062e5..f7bc8eb7 100644 --- a/occupi-backend/pkg/models/database.go +++ b/occupi-backend/pkg/models/database.go @@ -9,23 +9,23 @@ import ( // structure of user type User struct { - ID string `json:"_id" bson:"_id,omitempty"` - OccupiID string `json:"occupiId" bson:"occupiId"` - Password string `json:"password" bson:"password"` - Email string `json:"email" bson:"email"` - Role string `json:"role" bson:"role"` - OnSite bool `json:"onSite" bson:"onSite"` - IsVerified bool `json:"isVerified" bson:"isVerified"` - NextVerificationDate time.Time `json:"nextVerificationDate" bson:"nextVerificationDate"` - TwoFAEnabled bool `json:"twoFAEnabled" bson:"twoFAEnabled"` - KnownLocations []Location `json:"locations" bson:"locations"` - Details *Details `json:"details" bson:"details, omitempty"` - Notifications *Notifications `json:"notifications" bson:"notifications, omitempty"` - Security *Security `json:"security" bson:"security, omitempty"` - Status string `json:"status" bson:"status, omitempty"` - Position string `json:"position" bson:"position, omitempty"` - DepartmentNo string `json:"departmentNo" bson:"departmentNo, omitempty"` - ExpoPushToken string `json:"expoPushToken" bson:"expoPushToken"` + ID string `json:"_id" bson:"_id,omitempty"` + OccupiID string `json:"occupiId" bson:"occupiId"` + Password string `json:"password" bson:"password"` + Email string `json:"email" bson:"email"` + Role string `json:"role" bson:"role"` + OnSite bool `json:"onSite" bson:"onSite"` + IsVerified bool `json:"isVerified" bson:"isVerified"` + NextVerificationDate time.Time `json:"nextVerificationDate" bson:"nextVerificationDate"` + TwoFAEnabled bool `json:"twoFAEnabled" bson:"twoFAEnabled"` + KnownLocations []Location `json:"knownLocations" bson:"knownLocations"` + Details Details `json:"details" bson:"details, omitempty"` + Notifications Notifications `json:"notifications" bson:"notifications, omitempty"` + Security Security `json:"security" bson:"security, omitempty"` + Status string `json:"status" bson:"status, omitempty"` + Position string `json:"position" bson:"position, omitempty"` + DepartmentNo string `json:"departmentNo" bson:"departmentNo, omitempty"` + ExpoPushToken string `json:"expoPushToken" bson:"expoPushToken"` } type UserDetails struct {