diff --git a/app/http/endpoints/api/whitelabel/whitelabelpost.go b/app/http/endpoints/api/whitelabel/whitelabelpost.go index 38116e6..c9c416f 100644 --- a/app/http/endpoints/api/whitelabel/whitelabelpost.go +++ b/app/http/endpoints/api/whitelabel/whitelabelpost.go @@ -83,13 +83,13 @@ func WhitelabelPost(ctx *gin.Context) { } func validateToken(token string) bool { + split := strings.Split(token, ".") + // Check for 2 dots - if strings.Count(token, ".") != 2 { + if len(split) != 3 { return false } - split := strings.Split(token, ".") - // Validate bot ID // TODO: We could check the date on the snowflake if _, err := strconv.ParseUint(utils.Base64Decode(split[0]), 10, 64); err != nil { @@ -97,12 +97,7 @@ func validateToken(token string) bool { } // Validate time - timestamp, err := base64.RawURLEncoding.DecodeString(split[1]) - if err != nil { - return false - } - - if len(timestamp) != 4 { + if _, err := base64.RawURLEncoding.DecodeString(split[1]); err != nil { return false }