Give the machine console its own session with PIN sign-in, make counters cumulative
The console under console/ has its own session cookie and console guard (UseConsoleSession), so signing out or changing user there leaves the normal interface alone. Links open it in a new window through a one-time handoff key; a signed-out console asks for a PIN code or password on its own login page. Users set their 4-6 digit PIN on the profile's PIN page, and the console's change user dialog takes it on a keypad; five wrong PINs lock PIN sign-in for 15 minutes. Machine counters are cumulative: users record how much a job used and it is added to the latest reading. A maintenance record restarts the whole counter interval from the reading at the record. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Users\Presentation\Http\Controllers;
|
||||
|
||||
use App\Modules\Users\Presentation\Http\Middleware\SetLocale;
|
||||
use App\Modules\Users\Presentation\Http\Middleware\UseConsoleSession;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
/**
|
||||
* Signs out of the machine console's own session only (spec 19.6), e.g. to
|
||||
* sign in there with email and password; the normal user interface stays
|
||||
* signed in. The console's sign-in page returns to the console page.
|
||||
*/
|
||||
class ConsoleLogoutController
|
||||
{
|
||||
public function __invoke(Request $request): RedirectResponse
|
||||
{
|
||||
$locale = app()->getLocale();
|
||||
$returnTo = (string) $request->input('return_to', '');
|
||||
|
||||
Auth::logout();
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
$request->session()->put(SetLocale::SESSION_KEY, $locale);
|
||||
|
||||
if (UseConsoleSession::isConsoleUrl($returnTo)) {
|
||||
$request->session()->put('url.intended', $returnTo);
|
||||
}
|
||||
|
||||
return redirect()->route('console.login');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user