Fix broken time check
This commit is contained in:
parent
d34091e8ae
commit
0afe2f5239
@ -83,13 +83,13 @@ func WhitelabelPost(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func validateToken(token string) bool {
|
func validateToken(token string) bool {
|
||||||
|
split := strings.Split(token, ".")
|
||||||
|
|
||||||
// Check for 2 dots
|
// Check for 2 dots
|
||||||
if strings.Count(token, ".") != 2 {
|
if len(split) != 3 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
split := strings.Split(token, ".")
|
|
||||||
|
|
||||||
// Validate bot ID
|
// Validate bot ID
|
||||||
// TODO: We could check the date on the snowflake
|
// TODO: We could check the date on the snowflake
|
||||||
if _, err := strconv.ParseUint(utils.Base64Decode(split[0]), 10, 64); err != nil {
|
if _, err := strconv.ParseUint(utils.Base64Decode(split[0]), 10, 64); err != nil {
|
||||||
@ -97,12 +97,7 @@ func validateToken(token string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate time
|
// Validate time
|
||||||
timestamp, err := base64.RawURLEncoding.DecodeString(split[1])
|
if _, err := base64.RawURLEncoding.DecodeString(split[1]); err != nil {
|
||||||
if err != nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(timestamp) != 4 {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user