mirror of
https://github.com/projectsend/projectsend.git
synced 2026-09-20 18:43:20 +00:00
Let each role, and each person, choose where they land after signing in
A role now has a start page: the dashboard, files, upload, groups, clients or the activity log (the last two for staff only). Anyone can override their role's choice in their profile. The administrator role takes a start page too, while everything else about it stays locked. A choice is only used if the account can open that page now. Otherwise the next one down is tried, ending at the dashboard, so a permission removed later never lands somebody on a 403. A role cannot be saved with a start page its own permissions block. A link followed before signing in still wins, and a waiting getting-started or what's-new page still goes first. Applies to password, two-factor and provider sign-ins, and to the site root for someone already signed in. StartPageTest opens every page for real, with and without its permission, so the enum cannot drift from the routes. Requested by @Zodiac1978 in #1777.
This commit is contained in:
@@ -7,6 +7,7 @@ namespace App\Modules\Identity\Http\Controllers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use App\Modules\Identity\SignIn;
|
||||
use App\Modules\Identity\StartPages;
|
||||
use App\Modules\Identity\TwoFactor\TwoFactorService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -25,6 +26,7 @@ class TwoFactorChallengeController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private readonly TwoFactorService $twoFactor,
|
||||
private readonly StartPages $startPages,
|
||||
) {}
|
||||
|
||||
public function create(Request $request): Response|RedirectResponse
|
||||
@@ -77,7 +79,7 @@ class TwoFactorChallengeController extends Controller
|
||||
$request->session()->forget(SignIn::TWO_FACTOR_ID);
|
||||
$request->session()->regenerate();
|
||||
|
||||
return redirect()->intended(route('dashboard', absolute: false));
|
||||
return redirect()->intended($this->startPages->pathFor($user));
|
||||
}
|
||||
|
||||
private function pendingUser(Request $request): ?User
|
||||
|
||||
Reference in New Issue
Block a user