Keep the chosen language across sign-in and forced sign-out
A language picked on a signed-out page is now stored on the account when the user signs in (StoreLocaleChosenBeforeLogin), so the app does not switch back to the account default. EnsureAccountIsUsable keeps the user's language for the login page when it ends a disabled account's session. ChangePreferredLocale runs in a transaction like the other use cases, the language names come from layout.languages instead of the Locale enum, and the translation test also compares fi.json with en.json and rejects English files without a Finnish counterpart. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -14,13 +14,16 @@ use App\Modules\Users\Infrastructure\Persistence\Repositories\EloquentUserAccoun
|
||||
use App\Modules\Users\Infrastructure\Persistence\Repositories\EloquentUserAccountRepository;
|
||||
use App\Modules\Users\Infrastructure\SystemClock;
|
||||
use App\Modules\Users\Presentation\Console\CreateAdminCommand;
|
||||
use App\Modules\Users\Presentation\Http\Listeners\StoreLocaleChosenBeforeLogin;
|
||||
use App\Modules\Users\Presentation\Http\Middleware\EnsureAccountIsUsable;
|
||||
use App\Modules\Users\Presentation\Http\Middleware\SetLocale;
|
||||
use Illuminate\Auth\Events\Login;
|
||||
use Illuminate\Auth\Notifications\ResetPassword;
|
||||
use Illuminate\Contracts\Auth\CanResetPassword;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Session\Middleware\AuthenticateSession;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Validation\Rules\Password;
|
||||
@@ -63,6 +66,7 @@ class UsersServiceProvider extends ServiceProvider
|
||||
|
||||
// The language of the user interface; after the session has started.
|
||||
$router->pushMiddlewareToGroup('web', SetLocale::class);
|
||||
Event::listen(Login::class, StoreLocaleChosenBeforeLogin::class);
|
||||
|
||||
if ($this->app->runningInConsole()) {
|
||||
$this->commands([CreateAdminCommand::class]);
|
||||
|
||||
Reference in New Issue
Block a user