From b0cb73757aeb037f0d367e63697262621a192d32 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 16 Apr 2018 23:43:42 +0300 Subject: [PATCH] Support white label license with/without dashes --- app/Http/Controllers/NinjaController.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Http/Controllers/NinjaController.php b/app/Http/Controllers/NinjaController.php index c90b45b26c52..4a265a2a73d2 100644 --- a/app/Http/Controllers/NinjaController.php +++ b/app/Http/Controllers/NinjaController.php @@ -244,6 +244,16 @@ class NinjaController extends BaseController $licenseKey = Input::get('license_key'); $productId = Input::get('product_id', PRODUCT_ONE_CLICK_INSTALL); + // add in dashes + if (strlen($licenseKey) == 20) { + $licenseKey = sprintf('%s-%s-%s-%s-%s', + substr($licenseKey, 0, 4), + substr($licenseKey, 4, 4), + substr($licenseKey, 8, 4), + substr($licenseKey, 12, 4), + substr($licenseKey, 16, 4)); + } + $license = License::where('license_key', '=', $licenseKey) ->where('is_claimed', '<', 10) ->where('product_id', '=', $productId)