Global: New route for theme reset

Will be useful for themes such as "OpenVK Mobile".
This commit is contained in:
Ilya Prokopenko 2022-04-17 08:19:31 +03:00
parent 28c66af133
commit de1857388d
No known key found for this signature in database
GPG key ID: 7736BBBB05F14A56
2 changed files with 18 additions and 0 deletions

View file

@ -481,6 +481,22 @@ final class UserPresenter extends OpenVKPresenter
$this->flashFail("succ", tr("information_-1"), tr("two_factor_authentication_disabled_message")); $this->flashFail("succ", tr("information_-1"), tr("two_factor_authentication_disabled_message"));
} }
function renderResetThemepack(): void
{
$this->assertNoCSRF();
$this->setSessionTheme(Themepacks::DEFAULT_THEME_ID);
if($this->user) {
$this->willExecuteWriteAction();
$this->user->identity->setStyle(Themepacks::DEFAULT_THEME_ID);
$this->user->identity->save();
}
$this->redirect("/", static::REDIRECT_TEMPORARY_PRESISTENT);
}
function renderCoinsTransfer(): void function renderCoinsTransfer(): void
{ {
$this->assertUserLoggedIn(); $this->assertUserLoggedIn();

View file

@ -71,6 +71,8 @@ routes:
handler: "User->twoFactorAuthSettings" handler: "User->twoFactorAuthSettings"
- url: "/settings/2fa/disable" - url: "/settings/2fa/disable"
handler: "User->disableTwoFactorAuth" handler: "User->disableTwoFactorAuth"
- url: "/settings/reset_theme"
handler: "User->resetThemepack"
- url: "/coins_transfer" - url: "/coins_transfer"
handler: "User->coinsTransfer" handler: "User->coinsTransfer"
- url: "/increase_social_credits" - url: "/increase_social_credits"