本文整理汇总了PHP中opToolkit::generatePasswordString方法的典型用法代码示例。如果您正苦于以下问题:PHP opToolkit::generatePasswordString方法的具体用法?PHP opToolkit::generatePasswordString怎么用?PHP opToolkit::generatePasswordString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opToolkit
的用法示例。
在下文中一共展示了opToolkit::generatePasswordString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendMail
public function sendMail()
{
$token = md5(opToolkit::generatePasswordString());
$this->member->setConfig('password_recovery_token', $token);
$params = array('token' => $token, 'id' => $this->member->id, 'subject' => '【' . opConfig::get('sns_name') . '】パスワード再設定用URL発行のお知らせ');
sfOpenPNEMailSend::sendTemplateMail('passwordRecovery', $this->member->getEMailAddress(), opConfig::get('admin_mail_address'), $params);
}
示例2: preSave
public function preSave($event)
{
if (!$this->exists()) {
$this->key_string = opToolkit::generatePasswordString(16, false);
$this->secret = opToolkit::generatePasswordString(32);
}
}
示例3: new_access_token
public function new_access_token($token, $consumer)
{
$information = Doctrine::getTable('OAuthConsumerInformation')->findByKeyString($consumer->key);
if ($information) {
$key = opToolkit::generatePasswordString(16, false);
$secret = opToolkit::generatePasswordString(32, false);
$tokenRecord = $this->queryTemplate->andWhere('oauth_consumer_id = ?', $information->id)->andWhere('type = ?', 'access')->fetchOne();
if (!$tokenRecord) {
$tokenRecord = $this->recordTemplate;
}
$tokenRecord->setKeyString($key);
$tokenRecord->setSecret($secret);
$tokenRecord->setConsumer($information);
$tokenRecord->setType('access');
$tokenRecord->save();
return new OAuthToken($key, $secret);
}
return null;
}
示例4: executeUpdateConsumerSecret
/**
* Executes update consumer secret
*
* @param sfWebRequest $request
*/
public function executeUpdateConsumerSecret(sfWebRequest $request)
{
if ($request->isMethod(sfWebRequest::POST)) {
if (!$this->application->getConsumerKey()) {
$this->application->setConsumerKey(opToolkit::generatePasswordString(16, false));
}
$this->application->setConsumerSecret(opToolkit::generatePasswordString(32));
$this->application->save();
$this->redirect('@op_opensocial_info?id=' . $this->application->getId());
}
return sfView::INPUT;
}
示例5: setRememberLoginCookie
/**
* set remember login cookie
*/
protected function setRememberLoginCookie($isDeleteCookie = false)
{
$key = md5(sfContext::getInstance()->getRequest()->getHost());
$path = sfContext::getInstance()->getRequest()->getRelativeUrlRoot();
if (!$path) {
$path = '/';
}
if ($isDeleteCookie) {
if (!sfContext::getInstance()->getRequest()->getCookie($key)) {
return;
}
if ($this->getMemberId()) {
$this->getMember()->setConfig('remember_key', '');
}
$value = null;
$expire = time() - 3600;
} else {
$rememberKey = opToolkit::generatePasswordString();
if (!$this->getMemberId()) {
throw new LogicException('No login');
}
$this->getMember()->setConfig('remember_key', $rememberKey);
$value = base64_encode(serialize(array($this->getMemberId(), $rememberKey)));
$expire = time() + sfConfig::get('op_remember_login_limit', 60 * 60 * 24 * 30);
}
sfContext::getInstance()->getResponse()->setCookie($key, $value, $expire, $path, '', false, true);
}
示例6: save
public function save()
{
$member = $this->memberForm->save();
$this->setMember($member);
$profile = $this->profileForm->save($this->getMember()->getId());
$config = $this->configForm->save($this->getMember()->getId());
$auth = $this->doSave();
if ($member && $profile && $auth && $config) {
if ($this->getValue('mobile_uid')) {
$this->getMember()->setConfig('mobile_uid', $this->getValue('mobile_uid'));
}
$communities = Doctrine::getTable('Community')->getDefaultCommunities();
foreach ($communities as $community) {
Doctrine::getTable('CommunityMember')->join($this->getMember()->getId(), $community->getId());
}
if (sfConfig::get('op_is_mail_address_contain_hash')) {
$str = opToolkit::generatePasswordString(sfConfig::get('op_mail_address_hash_length', 12), false);
$this->getMember()->setConfig('mail_address_hash', strtolower($str));
}
return $this->getMember()->getId();
}
return false;
}
示例7: executeUpdateConsumerSecret
/**
* Executes update consumer secret
*
* @param sfWebRequest $request
*/
public function executeUpdateConsumerSecret(sfWebRequest $request)
{
$this->forward404Unless($this->member->getId() === $this->application->getMemberId());
if ($request->isMethod(sfWebRequest::POST)) {
if (!$this->application->getConsumerKey()) {
$this->application->setConsumerKey(opToolkit::generatePasswordString(16, false));
}
$this->application->setConsumerSecret(opToolkit::generatePasswordString(32));
$this->application->save();
$this->redirect('@application_info?id=' . $this->application->getId());
}
return sfView::INPUT;
}
示例8: executeUpdateBackendConsumerSecret
/**
* Executes update backend consumer secret
*
* @param sfWebRequest $request
*/
public function executeUpdateBackendConsumerSecret(sfWebRequest $request)
{
if ($request->isMethod(sfWebRequest::POST)) {
$request->checkCSRFProtection();
$snsConfigTable = Doctrine::getTable('SnsConfig');
if (!$snsConfigTable->get('shindig_backend_key')) {
$snsConfigTable->set('shindig_backend_key', opToolkit::generatePasswordString(16, false));
}
$snsConfigTable->set('shindig_backend_secret', opToolkit::generatePasswordString(32));
$this->redirect('@op_opensocial_container_config');
}
return sfView::INPUT;
}