File tree Expand file tree Collapse file tree 4 files changed +24
-1
lines changed
Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 5050 'title ' => 'Assign user role failed ' ,
5151 'body ' => 'Please ensure you have already run the migration and imported the default data. ' ,
5252 ],
53+ 'license_limit_exceeded ' => [
54+ 'title ' => 'User Limit Reached ' ,
55+ 'body ' => 'You have reached the maximum number of users allowed by your current license. Please upgrade your plan to add more users. ' ,
56+ ],
5357 ],
5458
5559];
Original file line number Diff line number Diff line change 5050 'title ' => '分配用戶角色失敗 ' ,
5151 'body ' => '請確保您已經運行遷移並導入默認數據。 ' ,
5252 ],
53+ 'license_limit_exceeded ' => [
54+ 'title ' => '用戶限制已達到 ' ,
55+ 'body ' => '您已達到當前許可證允許的最大用戶數。請升級您的計劃以添加更多用戶。 ' ,
56+ ],
5357 ],
5458
5559];
Original file line number Diff line number Diff line change @@ -100,10 +100,10 @@ protected function configureCmsPanel(Panel $panel)
100100 SubstituteBindings::class,
101101 DisableBladeIconComponents::class,
102102 DispatchServingFilamentEvent::class,
103+ CmsMiddleware \LicenseCheck::class,
103104 CmsMiddleware \SetUpPoweredBy::class,
104105 ];
105106 $ authMiddleware = [
106- CmsMiddleware \LicenseCheck::class,
107107 CmsMiddleware \CmsAuthenticate::class,
108108 CmsMiddleware \UserPreference::class,
109109 ];
Original file line number Diff line number Diff line change 1919use SolutionForest \InspireCms \Facades \PermissionManifest ;
2020use SolutionForest \InspireCms \Helpers \AuthHelper ;
2121use SolutionForest \InspireCms \InspireCmsConfig ;
22+ use SolutionForest \InspireCms \Licensing \LicenseManager ;
2223use SolutionForest \InspireCms \Models \Contracts \User ;
2324use Spatie \Permission \Traits \HasRoles ;
2425
@@ -83,6 +84,12 @@ public function mount(): void
8384
8485 public function register (): ?RegistrationResponse
8586 {
87+ if (! app (LicenseManager::class)->canCreateUser ()) {
88+ $ this ->getLicenseLimitNotification ()?->send();
89+
90+ return null ;
91+ }
92+
8693 try {
8794 $ this ->rateLimit (2 );
8895 } catch (TooManyRequestsException $ exception ) {
@@ -267,6 +274,14 @@ protected function getAssignRoleFailedNotification(): ?Notification
267274 ->danger ();
268275 }
269276
277+ protected function getLicenseLimitNotification (): ?Notification
278+ {
279+ return Notification::make ()
280+ ->title (__ ('inspirecms::pages/auth/register.messages.license_limit_exceeded.title ' ))
281+ ->body (__ ('inspirecms::pages/auth/register.messages.license_limit_exceeded.body ' ))
282+ ->danger ();
283+ }
284+
270285 public function getTitle (): string | Htmlable
271286 {
272287 return $ this ->isAlreadyInitialized ? __ ('inspirecms::pages/auth/register.title.installed ' ) : __ ('inspirecms::pages/auth/register.title.not_installed ' );
You can’t perform that action at this time.
0 commit comments