本文整理汇总了PHP中Authorization::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Authorization::get方法的具体用法?PHP Authorization::get怎么用?PHP Authorization::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authorization
的用法示例。
在下文中一共展示了Authorization::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Fetch
/**
* @param AuthorizedPage $Page
* @param string $Email
* @param string $AccessCode
* @param string $ClientKey
* @param string $ClientInfo
* @return Authorization|boolean
*/
public static function Fetch(AuthorizedPage $Page, $Email, $AccessCode, $ClientKey = null, $ClientInfo = null)
{
if (!$Page || !$Page->ID || !$Page->IsAllowedEmail(strtolower($Email))) {
return false;
}
return Authorization::get()->filter(array('PageID' => $Page->ID, 'Email' => strtolower($Email), 'AccessCode' => strtoupper($AccessCode), 'ClientKey' => $ClientKey ? $ClientKey : Authorization::generateClientKey(), 'ClientInfo' => $ClientInfo ? $ClientInfo : Authorization::generateClientInfo()))->First();
}
示例2: validateOneTimeCode
/**
* Validates the OneTimeCode against Authorization.
* Valid requests need tobe sent as POST with ott=OneTimeCode
* @return JSON
*/
public function validateOneTimeCode()
{
$return = array('valid' => false);
if ($this->request->postVar('ott')) {
if ($OTCcheck = Authorization::get()->filter('OneTimeCode', $this->request->postVar('ott'))->last()) {
$return['valid'] = true;
//Log that this token has been used
$OTCcheck->logOTC();
//As this token as been found we'll remove it and write the Authorization.
$OTCcheck->OneTimeCode = null;
$OTCcheck->write();
}
}
return $this->renderWith('json', array('json' => json_encode($return)));
}