From 0f3495a245a7cac8b777cd7f842a430434c48c1d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 23 May 2021 07:50:34 +1000 Subject: [PATCH 1/2] Set boolean type for signup fields --- app/Http/Requests/Account/CreateAccountRequest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Requests/Account/CreateAccountRequest.php b/app/Http/Requests/Account/CreateAccountRequest.php index 5d08157aca..3904bc5523 100644 --- a/app/Http/Requests/Account/CreateAccountRequest.php +++ b/app/Http/Requests/Account/CreateAccountRequest.php @@ -40,13 +40,13 @@ class CreateAccountRequest extends Request 'password' => 'required|string|min:6', 'email' => 'bail|required|email:rfc,dns', 'email' => new NewUniqueUserRule(), - 'privacy_policy' => 'required', - 'terms_of_service' => 'required', + 'privacy_policy' => 'required|boolean', + 'terms_of_service' => 'required|boolean', ]; } protected function prepareForValidation() - { + {nlog($this->all()); $input = $this->all(); $input['user_agent'] = request()->server('HTTP_USER_AGENT'); From c5a24fd9d99307811029b9b967b1a015fa54d6ac Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 23 May 2021 07:57:53 +1000 Subject: [PATCH 2/2] Fixes for OAuth using logging in over user/pass combinations --- app/Http/Controllers/Auth/LoginController.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 698857171b..772563845e 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -405,6 +405,20 @@ class LoginController extends BaseController 'oauth_user_id' => $google->harvestSubField($user), 'oauth_provider_id'=> 'google', ]); + + + $cu = CompanyUser::query() + ->where('user_id', auth()->user()->id); + + $cu->first()->account->companies->each(function ($company) use($cu){ + + if($company->tokens()->where('is_system', true)->count() == 0) + { + CreateCompanyToken::dispatchNow($company, $cu->first()->user, request()->server('HTTP_USER_AGENT')); + } + }); + + return $this->timeConstrainedResponse($cu); } }