本文整理汇总了PHP中CApi::getCsrfToken方法的典型用法代码示例。如果您正苦于以下问题:PHP CApi::getCsrfToken方法的具体用法?PHP CApi::getCsrfToken怎么用?PHP CApi::getCsrfToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CApi
的用法示例。
在下文中一共展示了CApi::getCsrfToken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SystemSecurity
public function SystemSecurity()
{
$bDoSave = true;
if (CApi::getCsrfToken('p7admToken') === CPost::get('txtToken')) {
if (CPost::Has('txtNewPassword') && CPost::Has('txtConfirmNewPassword')) {
$oWebmailApi = CApi::Manager('webmail');
if (!$oWebmailApi->validateAdminPassword(trim(CPost::get('txtOldPassword')))) {
$bDoSave = false;
$this->LastError = CM_PASSWORDS_INVALID_OLD;
} else {
if ((string) CPost::get('txtNewPassword') !== (string) CPost::get('txtConfirmNewPassword')) {
$bDoSave = false;
$this->LastError = CM_PASSWORDS_NOT_MATCH;
} else {
if (AP_DUMMYPASSWORD !== (string) CPost::get('txtNewPassword')) {
$this->oSettings->SetConf('Common/AdminPassword', md5(trim(CPost::get('txtNewPassword'))));
}
}
}
if ($bDoSave) {
if (CPost::Has('txtUserName')) {
$this->oSettings->SetConf('Common/AdminLogin', CPost::get('txtUserName'));
}
$this->saveSettingsXmlWithMessage();
}
}
} else {
$this->LastError = CApi::I18N('API/INVALID_TOKEN');
}
}
示例2: SystemSecurity
public function SystemSecurity(ap_Standard_Screen &$oScreen)
{
$oScreen->Data->SetValue('txtUserName', $this->oSettings->GetConf('Common/AdminLogin'));
$oScreen->Data->SetValue('txtOldPassword', AP_DUMMYPASSWORD);
$oScreen->Data->SetValue('txtToken', CApi::getCsrfToken('p7admToken'));
$oScreen->Data->SetValue('txtNewPassword', AP_DUMMYPASSWORD);
$oScreen->Data->SetValue('txtConfirmNewPassword', AP_DUMMYPASSWORD);
}