UseLangs(true); // start use langs folder $this->addJs('js/ChangePasswordUserSettings.js'); // add js file $this->addJsonHook('ChangePassword', 'ChangePassword'); $this->addTemplate('templates/SettingsChangePassword.html'); /** * Admin */ /* $this->addJs('js/ChangePasswordAdminSettings.js', true); // add js file $this->addJsonHook('AdminChangePassword', 'AdminChangePassword'); $this->addTemplate('templates/ChangePasswordAdminSettings.html', true); */ } public function ChangePassword() { $sPrevPassword = $this->jsonParam('PrevPassword'); $sNewPassword = $this->jsonParam('NewPassword'); $oActions = $this->Manager()->Actions(); $oAccount = $oActions->GetAccount(); /* if (!$this->isPossible($oAccount)) { throw new ClientException(static::CouldNotSaveNewPassword); } */ if ($sPrevPassword !== $oAccount->Password()) { throw new ClientException(static::CurrentPasswordIncorrect, null, $oActions->StaticI18N('NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT')); } $sPasswordForCheck = \trim($sNewPassword); if (10 > \strlen($sPasswordForCheck)) { throw new ClientException(static::NewPasswordShort, null, $oActions->StaticI18N('NOTIFICATIONS/NEW_PASSWORD_SHORT')); } if (!\MailSo\Base\Utils::PasswordWeaknessCheck($sPasswordForCheck)) { throw new ClientException(static::NewPasswordWeak, null, $oActions->StaticI18N('NOTIFICATIONS/NEW_PASSWORD_WEAK')); } /* if (!$this->oDriver->ChangePassword($oAccount, $sPrevPassword, $sNewPassword)) { throw new ClientException(static::CouldNotSaveNewPassword); } $oAccount->SetPassword($sNewPassword); $oActions->SetAuthToken($oAccount); */ return $oActions->GetSpecAuthToken(); // return $this->jsonResponse(__FUNCTION__, $oActions->GetSpecAuthToken()); } public function AdminChangePassword() { } }