diff --git a/config/auth.php b/config/auth.php index d5abfb7..b1e35b4 100644 --- a/config/auth.php +++ b/config/auth.php @@ -46,7 +46,7 @@ | This value will be used to across system where model is needed */ 'role_model' => \Fintech\Auth\Models\Role::class, - + 'default_roles_customer' => [], /* |-------------------------------------------------------------------------- | Team Model diff --git a/src/Http/Controllers/MobileVerificationController.php b/src/Http/Controllers/MobileVerificationController.php index cab7971..c3080e5 100644 --- a/src/Http/Controllers/MobileVerificationController.php +++ b/src/Http/Controllers/MobileVerificationController.php @@ -25,4 +25,20 @@ public function store(Request $request): JsonResponse|RedirectResponse return response()->json(['status' => 'verification-link-sent']); } + + /** + * Send a new email verification notification. + * @param Request $request + * @return JsonResponse|RedirectResponse + */ + public function update(Request $request): JsonResponse|RedirectResponse + { + if ($request->user()->hasVerifiedEmail()) { + return redirect()->intended(RouteServiceProvider::HOME); + } + + $request->user()->sendEmailVerificationNotification(); + + return response()->json(['status' => 'verification-link-sent']); + } } diff --git a/src/Services/UserService.php b/src/Services/UserService.php index ab4509c..8f8bc6f 100644 --- a/src/Services/UserService.php +++ b/src/Services/UserService.php @@ -92,7 +92,7 @@ private function formatUserDataFromInput($inputs) $data['fcm_token'] = $inputs['fcm_token'] ?? null; $data['language'] = $inputs['language'] ?? null; $data['currency'] = $inputs['currency'] ?? null; - $data['roles'] = $inputs['roles'] ?? []; + $data['roles'] = $inputs['roles'] ?? config('fintech.auth.default_roles_customer', []); return $data; }