mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Validate user timezone given from login data before saving it
Follow-up to #36000 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
e235c6438c
commit
6b7da88b0b
1 changed files with 5 additions and 1 deletions
|
|
@ -43,7 +43,7 @@ class SetUserTimezoneCommand extends ALoginCommand {
|
|||
}
|
||||
|
||||
public function process(LoginData $loginData): LoginResult {
|
||||
if ($loginData->getTimeZoneOffset() !== '') {
|
||||
if ($loginData->getTimeZoneOffset() !== '' && $this->isValidTimezone($loginData->getTimeZone())) {
|
||||
$this->config->setUserValue(
|
||||
$loginData->getUser()->getUID(),
|
||||
'core',
|
||||
|
|
@ -58,4 +58,8 @@ class SetUserTimezoneCommand extends ALoginCommand {
|
|||
|
||||
return $this->processNextOrFinishSuccessfully($loginData);
|
||||
}
|
||||
|
||||
private function isValidTimezone(?string $value): bool {
|
||||
return $value && in_array($value, \DateTimeZone::listIdentifiers());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue