mirror of
https://github.com/projectsend/projectsend.git
synced 2026-09-12 06:48:55 +00:00
6e47d76ba6
Client file sharing, rebuilt from the ground up: a private area per client, resumable uploads, folders, groups and categories, sharing with expiry dates and download limits, comments, file versions, an activity log, a REST API, and sixteen languages. This repository begins here. ProjectSend 2 was developed privately, and that development history is not published — the previous generation remains available, with its own history, at projectsend/legacy. Free software under the GNU General Public License v2, or (at your option) any later version.
41 lines
1.3 KiB
PHP
41 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\Platform\Http\Controllers;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Support\Rules;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
/**
|
|
* The write path for the silent browser detection that runs on first
|
|
* sign-in (timezone-detector.tsx), which needs somewhere to post a zone
|
|
* without a form around it.
|
|
*
|
|
* The profile screen does *not* come through here — it saves the timezone
|
|
* with the rest of the profile, so that page keeps one Save button rather
|
|
* than growing a second one for a single field. Both paths validate
|
|
* through Rules::timezone(), so the format is defined once even though the
|
|
* two writes are separate.
|
|
*
|
|
* Unlike the locale, nothing is put in the session: the whole point of
|
|
* persisting to the column is that the resolved zone is the same on every
|
|
* device this account signs in from, and a guest has no preference to
|
|
* store in the first place.
|
|
*/
|
|
class TimezoneController extends Controller
|
|
{
|
|
public function update(Request $request): RedirectResponse
|
|
{
|
|
$validated = $request->validate([
|
|
'timezone' => ['required', ...Rules::timezone()],
|
|
]);
|
|
|
|
$request->user()?->update(['timezone' => $validated['timezone']]);
|
|
|
|
return back();
|
|
}
|
|
}
|