From 7af83732eb2f280ac9a57bd51d75e6b28da60d01 Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Thu, 4 Jan 2018 23:02:39 -0700 Subject: [PATCH] Validate unhashed Hashids and return only first array value --- backend/Token.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/Token.php b/backend/Token.php index 519794d..a087df1 100644 --- a/backend/Token.php +++ b/backend/Token.php @@ -35,6 +35,10 @@ class Token { } public function unhash ($hash) { - return $this->hashids->decode($hash); + $unhashed = $this->hashids->decode($hash); + if (count($unhashed) > 0) { + return $unhashed[0]; + } + return false; } } \ No newline at end of file