• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Zend_OpenId类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Zend_OpenId的典型用法代码示例。如果您正苦于以下问题:PHP Zend_OpenId类的具体用法?PHP Zend_OpenId怎么用?PHP Zend_OpenId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Zend_OpenId类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getMail

 /**
  * @return Zend_Mail
  * @throws Zend_Mail_Protocol_Exception
  */
 public static function getMail(Users_Model_User $user, $subject)
 {
     $file = CommunityID_Resources::getResourcePath('reminder_mail.txt');
     $emailTemplate = file_get_contents($file);
     $emailTemplate = str_replace('{userName}', $user->getFullName(), $emailTemplate);
     $currentUrl = Zend_OpenId::selfURL();
     preg_match('#(.*)/manageusers/sendreminder#', $currentUrl, $matches);
     $emailTemplate = str_replace('{registrationURL}', $matches[1] . '/register/eula?token=' . $user->token, $emailTemplate);
     // can't use $this->_config 'cause it's a static function
     $configEmail = Zend_Registry::get('config')->email;
     switch (strtolower($configEmail->transport)) {
         case 'smtp':
             Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Smtp($configEmail->host, $configEmail->toArray()));
             break;
         case 'mock':
             Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Mock());
             break;
         default:
             Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Sendmail());
     }
     $mail = new Zend_Mail('UTF-8');
     $mail->setBodyText($emailTemplate);
     $mail->setFrom($configEmail->supportemail);
     $mail->addTo($user->email);
     $mail->setSubject($subject);
     return $mail;
 }
开发者ID:sdgdsffdsfff,项目名称:auth-center,代码行数:31,代码来源:ManageusersController.php


示例2: indexAction

 public function indexAction()
 {
     $this->view->headTitle("User", 'PREPEND');
     $openid = $this->getRequest()->getParam('openid');
     if (isset($openid)) {
         $this->view->openIdServer = Zend_OpenId::absoluteURL("/provider/");
     } else {
         $this->_redirect('/user/login');
     }
 }
开发者ID:heiglandreas,项目名称:Zend-Framework-OpenID-Provider,代码行数:10,代码来源:IndexController.php


示例3: save

 public function save(Default_Model_User $user)
 {
     $data = array('username' => $user->getUsername(), 'password' => md5($user->getUsername() . $user->getPassword()), 'created' => date('Y-m-d H:i:s'), 'openid' => Zend_OpenId::absoluteURL('/openid/' . $user->getUsername()), 'user_type' => $user->getUserType());
     if (null === ($id = $user->getId())) {
         $id = $this->getDbTable()->insert($data);
     } else {
         $this->getDbTable()->update($data, array('id = ?' => $id));
     }
     return $id;
 }
开发者ID:heiglandreas,项目名称:Zend-Framework-OpenID-Provider,代码行数:10,代码来源:UserMapper.php


示例4: login

 /**
  * Performs login of user with given $id, $password and $username
  * Returns true in case of success and false otherwise
  *
  * @param string $id user identity URL
  * @param string $password user password
  * @param string $username Tine 2.0 login name
  * @return bool
  */
 public function login($id, $password, $username = null)
 {
     if (!Zend_OpenId::normalize($id)) {
         return false;
     }
     if (!$this->_storage->checkUser($id, $password, $username)) {
         return false;
     }
     $this->_user->setLoggedInUser($id);
     return true;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:20,代码来源:Provider.php


示例5: direct

 public function direct($config)
 {
     $currentUrl = urldecode(Zend_OpenId::selfURL());
     if ($config->subdomain->enabled) {
         $protocol = Monkeys_Controller_Action::getProtocol();
         preg_match('#(.*)\\.' . $config->subdomain->hostname . '#', $currentUrl, $matches);
         return "{$protocol}://" . ($config->subdomain->use_www ? 'www.' : '') . $config->subdomain->hostname . '/openid/provider';
     } else {
         preg_match('#(.*)/(identity|openid)?/#', $currentUrl, $matches);
         return $matches[1] . '/openid/provider';
     }
 }
开发者ID:sdgdsffdsfff,项目名称:auth-center,代码行数:12,代码来源:ProviderUrl.php


示例6: normalize

 /**
  * Normalizes OpenID identifier that can be URL or XRI name.
  * Returns true on success and false of failure.
  *
  * Normalization is performed according to the following rules:
  * 1. If the user's input starts with one of the "xri://", "xri://$ip*",
  *    or "xri://$dns*" prefixes, they MUST be stripped off, so that XRIs
  *    are used in the canonical form, and URI-authority XRIs are further
  *    considered URL identifiers.
  * 2. If the first character of the resulting string is an XRI Global
  *    Context Symbol ("=", "@", "+", "$", "!"), then the input SHOULD be
  *    treated as an XRI.
  * 3. Otherwise, the input SHOULD be treated as an http URL; if it does
  *    not include a "http" or "https" scheme, the Identifier MUST be
  *    prefixed with the string "http://".
  * 4. URL identifiers MUST then be further normalized by both following
  *    redirects when retrieving their content and finally applying the
  *    rules in Section 6 of [RFC3986] to the final destination URL.
  * @param string &$id identifier to be normalized
  * @return bool
  */
 public static function normalize(&$id)
 {
     $validator = new Zend_Validate_EmailAddress();
     if ($validator->isValid($id)) {
         if (false !== strpos($id, 'gmail')) {
             $id = 'https://www.google.com/accounts/o8/id';
             return true;
         }
         $email = explode('@', $id);
         $id = 'https://www.google.com/accounts/o8/site-xrds?ns=2&hd=' . $email[1];
         return true;
     } else {
         return Zend_OpenId::normalize($id);
     }
 }
开发者ID:highfidelity,项目名称:love,代码行数:36,代码来源:OpenId.php


示例7: getMail

    /**
     * @return Zend_Mail
     * @throws Zend_Mail_Protocol_Exception
     */
    public static function getMail(Exception $ex, User $user, $errors)
    {
        $exceptionClass = get_class($ex);
        $stack = $ex->getTraceAsString();
        $stackDetail = print_r($errors, true);
        $currentUrl = Zend_OpenId::selfURL();
        if ($user->role = ROLE_GUEST) {
            $userLabel = 'Anonymous';
        } else {
            $userLabel = $user->getFullName() . '(' . $user->username . ')';
        }
        $body = <<<EOD
Dear Admin,

An error has occured in your Community-ID installation.

URL requested: {$currentUrl}

By User: {$userLabel}

Exception: {$exceptionClass}

Call stack:
{$stack}

Call stack detail:
{$stackDetail}
EOD;
        // can't use $this-_config 'cause it's a static function
        $configEmail = Zend_Registry::get('config')->email;
        switch (strtolower($configEmail->transport)) {
            case 'smtp':
                Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Smtp($configEmail->host, $configEmail->toArray()));
                break;
            case 'mock':
                Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Mock());
                break;
            default:
                Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Sendmail());
        }
        $mail = new Zend_Mail();
        $mail->setBodyText($body);
        $mail->setFrom($this->_config->email->supportemail);
        $mail->addTo($configEmail->adminemail);
        $mail->setSubject('Community-ID error report');
        return $mail;
    }
开发者ID:sdgdsffdsfff,项目名称:auth-center,代码行数:51,代码来源:Error.php


示例8: HandleObjectCategories

 function HandleObjectCategories($objectCategoryIds)
 {
     global $prefs;
     $perspectivelib = TikiLib::lib('perspective');
     $current_object = current_object();
     if (!$current_object) {
         // only used on tiki objects
         return;
     }
     $descendants = $this->get_category_descendants($prefs['areas_root']);
     $objectPerspective = 0;
     if (!empty($objectCategoryIds)) {
         if (!isset($_SESSION['current_perspective'])) {
             unset($_SESSION['current_perspective']);
         }
         foreach ($objectCategoryIds as $categId) {
             // If category is inside $prefs['areas_root']
             if (in_array($categId, $descendants)) {
                 $area = $this->getAreaByCategId($categId);
                 if ($area) {
                     $objectPerspective = $area['perspectives'][0];
                     // use 1st persp
                     break;
                 }
             }
         }
         if ($objectPerspective && $objectPerspective != $_SESSION['current_perspective']) {
             $area = $this->getAreaByPerspId($_SESSION['current_perspective']);
             $objectArea = $this->getAreaByPerspId($objectPerspective);
             if ($area && !$area['share_common'] || $objectArea && $objectArea['exclusive']) {
                 $perspectivelib->set_perspective($objectPerspective, true);
                 Zend_OpenId::redirect(Zend_OpenId::selfUrl());
             }
         }
     }
     if ($objectPerspective < 1 && !empty($_SESSION['current_perspective'])) {
         // uncategorised objects
         $area = $this->getAreaByPerspId($_SESSION['current_perspective']);
         if ($area) {
             if (!$area['share_common']) {
                 $perspectivelib->set_perspective($objectPerspective, true);
                 Zend_OpenId::redirect(Zend_OpenId::selfUrl());
             }
         }
     }
 }
开发者ID:ameoba32,项目名称:tiki,代码行数:46,代码来源:binderlib.php


示例9: _makeVerifyParameters

 /**
  * Подготовить набор параметров для verify
  *
  * @return array
  */
 protected function _makeVerifyParameters(array $extraParams = array())
 {
     $_SERVER['SCRIPT_URI'] = 'http://localhost/index.php/auth/openid/verify';
     $expiresIn = TIME + 600;
     $this->storage->addDiscoveryInfo(self::ID, self::REAL_ID, self::SERVER, 1.1, $expiresIn);
     $this->storage->addAssociation(self::SERVER, self::HANDLE, "sha1", $secret = pack("H*", "8382aea922560ece833ba55fa53b7a975f597370"), $expiresIn);
     $params = array("openid_return_to" => $_SERVER['SCRIPT_URI'], "openid_assoc_handle" => self::HANDLE, "openid_claimed_id" => self::ID, "openid_identity" => self::REAL_ID, "openid_response_nonce" => "2007-08-14T12:52:33Z46c1a59124ffe", "openid_mode" => "id_res", "openid_signed" => "assoc_handle,return_to,claimed_id,identity,response_nonce,mode,signed");
     $signed = array($params["openid_signed"]);
     if ($extraParams) {
         $params = array_merge($params, $extraParams);
         // TODO: Фуууууу
         $extraParams2 = explode(',', str_replace('_', '.', implode(',', array_keys($extraParams))));
         $signed = array_merge($signed, $extraParams2);
     }
     $params["openid_signed"] = str_replace('openid.', '', implode(',', $signed));
     // Подписать данные
     $data = '';
     foreach (explode(',', $params['openid_signed']) as $key) {
         $data .= $key . ':' . $params['openid_' . strtr($key, '.', '_')] . "\n";
     }
     $params['openid_sig'] = base64_encode(\Zend_OpenId::hashHmac('sha1', $data, $secret));
     return $params;
 }
开发者ID:pycmam,项目名称:sfOpenAuthPlugin,代码行数:28,代码来源:BaseTestCase.php


示例10: absoluteUrl

 /**
  * Returns an absolute URL for the given one
  *
  * @param string $url absilute or relative URL
  * @return string
  */
 public static function absoluteUrl($url)
 {
     if (empty($url)) {
         return Zend_OpenId::selfUrl();
     } else {
         if (!preg_match('|^([^:]+)://|', $url)) {
             if (preg_match('|^([^:]+)://([^:@]*(?:[:][^@]*)?@)?([^/:@?#]*)(?:[:]([^/?#]*))?(/[^?]*)?((?:[?](?:[^#]*))?(?:#.*)?)$|', Zend_OpenId::selfUrl(), $reg)) {
                 $scheme = $reg[1];
                 $auth = $reg[2];
                 $host = $reg[3];
                 $port = $reg[4];
                 $path = $reg[5];
                 $query = $reg[6];
                 if ($url[0] == '/') {
                     return $scheme . '://' . $auth . $host . (empty($port) ? '' : ':' . $port) . $url;
                 } else {
                     $dir = dirname($path);
                     return $scheme . '://' . $auth . $host . (empty($port) ? '' : ':' . $port) . (strlen($dir) > 1 ? $dir : '') . '/' . $url;
                 }
             }
         }
     }
     return $url;
 }
开发者ID:smarcet,项目名称:openstackid,代码行数:30,代码来源:OpenIdUriHelper.php


示例11: realpath

$dir = realpath(__DIR__ . "/../../..");
set_include_path("{$dir}/incubator/library" . PATH_SEPARATOR . "{$dir}/library" . PATH_SEPARATOR . get_include_path());
/**
 * @see Zend_Auth
 */
require_once "Zend/Auth.php";
/**
 * @see Zend_Auth_Adapter_OpenId
 */
require_once "Zend/Auth/Adapter/OpenId.php";
$status = "";
$auth = Zend_Auth::getInstance();
if (isset($_POST['openid_action']) && $_POST['openid_action'] == "login" && !empty($_POST['openid_identifier']) || isset($_GET['openid_mode']) || isset($_POST['openid_mode'])) {
    $result = $auth->authenticate(new Zend_Auth_Adapter_OpenId(@$_POST['openid_identifier']));
    if ($result->isValid()) {
        Zend_OpenId::redirect(Zend_OpenId::selfURL());
    } else {
        $auth->clearIdentity();
        foreach ($result->getMessages() as $message) {
            $status .= "{$message}<br>\n";
        }
    }
} else {
    if ($auth->hasIdentity()) {
        if (isset($_POST['openid_action']) && $_POST['openid_action'] == "logout") {
            $auth->clearIdentity();
        } else {
            $status = "You are logged-in as " . $auth->getIdentity() . "<br>\n";
        }
    }
}
开发者ID:alab1001101,项目名称:zf2,代码行数:31,代码来源:test_auth.php


示例12: getUserWithUsername

 public function getUserWithUsername($username, $generateNewIfMissing = false, Zend_View $view = null)
 {
     $select = $this->select()->where('username=?', $username);
     $user = $this->fetchRow($select);
     $ldapOptions = Zend_Registry::get('config')->ldap;
     if ($ldapOptions->enabled) {
         $ldap = Monkeys_Ldap::getInstance();
         try {
             $ldapUserData = $ldap->get("cn={$username},{$ldapOptions->baseDn}");
         } catch (Exception $e) {
             if ($e->getCode() == Monkeys_Ldap::EXCEPTION_SEARCH) {
                 return false;
             }
             throw $e;
         }
         if ($user) {
             // this fields are always overridden from what comes from LDAP, because they might change
             $user->overrideWithLdapData($ldapUserData);
         } else {
             // user is registered in LDAP, but not in CID's db
             $user = $this->createRow();
             $user->registration_date = date('Y-m-d');
             $user->overrideWithLdapData($ldapUserData);
             if ($user->role != Users_Model_User::ROLE_ADMIN) {
                 preg_match('#(.*)/users/login/authenticate#', Zend_OpenId::selfURL(), $matches);
                 $user->generateOpenId($matches[1]);
             }
             if ($generateNewIfMissing) {
                 $user->save();
                 $profileId = $user->createDefaultProfile($view);
                 $user->generatePersonalInfo($ldapUserData, $profileId);
             }
         }
     }
     return $user;
 }
开发者ID:sdgdsffdsfff,项目名称:auth-center,代码行数:36,代码来源:Users.php


示例13: openId

 /**
  * handle all kinds of openId requests
  * 
  * @return void
  */
 public function openId()
 {
     Tinebase_Core::startCoreSession();
     $server = new Tinebase_OpenId_Provider(null, null, new Tinebase_OpenId_Provider_User_Tine20(), new Tinebase_OpenId_Provider_Storage());
     $server->setOpEndpoint(dirname(Zend_OpenId::selfUrl()) . '/index.php?method=Tinebase.openId');
     // handle openId login form
     if (isset($_POST['openid_action']) && $_POST['openid_action'] === 'login') {
         $server->login($_POST['openid_identifier'], $_POST['password'], $_POST['username']);
         unset($_GET['openid_action']);
         $this->_setJsonKeyCookie();
         Zend_OpenId::redirect(dirname(Zend_OpenId::selfUrl()) . '/index.php', $_GET);
         // display openId login form
     } else {
         if (isset($_GET['openid_action']) && $_GET['openid_action'] === 'login') {
             $view = new Zend_View();
             $view->setScriptPath('Tinebase/views');
             $view->openIdIdentity = $_GET['openid_identity'];
             $view->loginName = $_GET['openid_identity'];
             header('Content-Type: text/html; charset=utf-8');
             echo $view->render('openidLogin.php');
             // handle openId trust form
         } else {
             if (isset($_POST['openid_action']) && $_POST['openid_action'] === 'trust') {
                 if (isset($_POST['allow'])) {
                     if (isset($_POST['forever'])) {
                         $server->allowSite($server->getSiteRoot($_GET));
                     }
                     $server->respondToConsumer($_GET);
                 } else {
                     if (isset($_POST['deny'])) {
                         if (isset($_POST['forever'])) {
                             $server->denySite($server->getSiteRoot($_GET));
                         }
                         Zend_OpenId::redirect($_GET['openid_return_to'], array('openid.mode' => 'cancel'));
                     }
                 }
                 // display openId trust form
             } else {
                 if (isset($_GET['openid_action']) && $_GET['openid_action'] === 'trust') {
                     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " Display openId trust screen");
                     }
                     $view = new Zend_View();
                     $view->setScriptPath('Tinebase/views');
                     $view->openIdConsumer = $server->getSiteRoot($_GET);
                     $view->openIdIdentity = $server->getLoggedInUser();
                     header('Content-Type: text/html; charset=utf-8');
                     echo $view->render('openidTrust.php');
                     // handle all other openId requests
                 } else {
                     $result = $server->handle();
                     if (is_string($result)) {
                         echo $result;
                     } elseif ($result !== true) {
                         header('HTTP/1.0 403 Forbidden');
                         return;
                     }
                 }
             }
         }
     }
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:67,代码来源:Http.php


示例14: testBtwoc

 /**
  * testing testBtwoc
  *
  */
 public function testBtwoc()
 {
     $this->assertSame( '00', bin2hex(Zend_OpenId::btwoc(pack('H*', '00'))) );
     $this->assertSame( '01', bin2hex(Zend_OpenId::btwoc(pack('H*', '01'))) );
     $this->assertSame( '7e', bin2hex(Zend_OpenId::btwoc(pack('H*', '7e'))) );
     $this->assertSame( '78', bin2hex(Zend_OpenId::btwoc(pack('H*', '78'))) );
     $this->assertSame( '0080', bin2hex(Zend_OpenId::btwoc(pack('H*', '80'))) );
     $this->assertSame( '0081', bin2hex(Zend_OpenId::btwoc(pack('H*', '81'))) );
     $this->assertSame( '00fe', bin2hex(Zend_OpenId::btwoc(pack('H*', 'fe'))) );
     $this->assertSame( '00ff', bin2hex(Zend_OpenId::btwoc(pack('H*', 'ff'))) );
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:15,代码来源:OpenIdTest.php


示例15: Zend_OpenId_Extension_Sreg

 if ($_POST['openid_action'] == 'trust') {
     if (isset($_GET['openid_return_to'])) {
         $sreg = new Zend_OpenId_Extension_Sreg();
         $sreg->parseResponse($_POST);
         if (isset($_POST['allow'])) {
             if (isset($_POST['forever'])) {
                 $server->allowSite($server->getSiteRoot($_GET), $sreg);
             }
             unset($_GET['openid_action']);
             $server->respondToConsumer($_GET, $sreg);
         } else {
             if (isset($_POST['deny'])) {
                 if (isset($_POST['forever'])) {
                     $server->denySite($server->getSiteRoot($_GET));
                 }
                 Zend_OpenId::redirect($_GET['openid_return_to'], array('openid.mode' => 'cancel'));
             }
         }
     } else {
         if (isset($_POST['allow'])) {
             $server->allowSite($_POST['site']);
             header('Location: ' . $_SERVER['PHP_SELF']);
             exit;
         } else {
             if (isset($_POST['deny'])) {
                 $server->denySite($_POST['site']);
                 header('Location: ' . $_SERVER['PHP_SELF']);
                 exit;
             } else {
                 if (isset($_POST['del'])) {
                     $server->delSite($_POST['site']);
开发者ID:alab1001101,项目名称:zf2,代码行数:31,代码来源:test_server.php


示例16: btnLogin_Click

 public function btnLogin_Click($strFormId, $strControlId, $strParameter)
 {
     require_once "Zend/Auth.php";
     require_once "Zend/Auth/Adapter/OpenId.php";
     require_once "Zend/Auth/Storage/NonPersistent.php";
     $this->txtOpenIdUrl->Text = preg_replace('/\\/$/', '', $this->txtOpenIdUrl->Text);
     $status = "";
     $auth = Zend_Auth::getInstance();
     $result = $auth->authenticate(new Zend_Auth_Adapter_OpenId($this->txtOpenIdUrl->Text));
     if ($result->isValid()) {
         Zend_OpenId::redirect(Zend_OpenId::selfURL());
     } else {
         $auth->clearIdentity();
         foreach ($result->getMessages() as $message) {
             $status .= "{$message}<br>\n";
         }
         $this->lblMessage->ForeColor = 'red';
         $this->lblMessage->Text = 'OpenId: ' . $status;
         return false;
     }
 }
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:21,代码来源:word_list.php


示例17: testSetSelfUrl

 /**
  * testing setSelfUrl
  *
  */
 public function testSetSelfUrl()
 {
     unset($_SERVER['SCRIPT_URI']);
     unset($_SERVER['HTTPS']);
     unset($_SERVER['HTTP_HOST']);
     unset($_SERVER['SERVER_NAME']);
     unset($_SERVER['SERVER_PORT']);
     unset($_SERVER['SCRIPT_URL']);
     unset($_SERVER['REDIRECT_URL']);
     unset($_SERVER['PHP_SELF']);
     unset($_SERVER['SCRIPT_NAME']);
     unset($_SERVER['PATH_INFO']);
     $_SERVER['SCRIPT_URI'] = "http://www.test.com/";
     $this->assertSame('http://www.test.com/', Zend_OpenId::selfUrl());
     $this->assertSame(null, Zend_OpenId::setSelfUrl("http://localhost/test"));
     $this->assertSame("http://localhost/test", Zend_OpenId::selfUrl());
     $this->assertSame("http://localhost/test", Zend_OpenId::setSelfUrl());
     $this->assertSame('http://www.test.com/', Zend_OpenId::selfUrl());
     $this->assertSame(null, Zend_OpenId::setSelfUrl());
     $this->assertSame('http://www.test.com/', Zend_OpenId::selfUrl());
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:25,代码来源:OpenIdTest.php


示例18: __construct

 * obtain it through the world-wide-web, please send an email
 * to [email protected] so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_OpenId
 * @copyright  Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id:$
 */

/**
 * Zend_OpenId
 */
require_once 'Zend/OpenId.php';

Zend_OpenId::$exitOnRedirect = false;

/**
 * @package    Zend_OpenId
 * @subpackage UnitTests
 */
class Zend_OpenId_ResponseHelper extends Zend_Controller_Response_Abstract
{
    private $_canSendHeaders;

    public function __construct($canSendHeaders)
    {
        $this->_canSendHeaders = $canSendHeaders;
    }

    public function canSendHeaders($throw = false)
开发者ID:jorgenils,项目名称:zend-framework,代码行数:31,代码来源:ResponseHelper.php


示例19: idAction

 public function idAction()
 {
     $this->view->headLink()->headLink(array('rel' => 'openid.server', 'href' => $this->_helper->ProviderUrl($this->_config)));
     $this->view->headLink()->headLink(array('rel' => 'openid2.provider', 'href' => $this->_helper->ProviderUrl($this->_config)));
     $this->view->idUrl = urldecode(Zend_OpenId::selfURL());
 }
开发者ID:sdgdsffdsfff,项目名称:auth-center,代码行数:6,代码来源:IdentityController.php


示例20: saveaccountinfoAction

 public function saveaccountinfoAction()
 {
     $isNewUser = is_null($this->targetUser->id) ? true : false;
     if (!$isNewUser && $this->targetUser->id != $this->user->id || $this->_config->ldap->enabled && !$this->_config->ldap->keepRecordsSynced) {
         throw new Monkeys_AccessDeniedException();
     }
     $form = new Users_Form_AccountInfo(null, $this->targetUser);
     $formData = $this->_request->getPost();
     $form->populate($formData);
     if (!$form->isValid($formData)) {
         return $this->_redirectInvalidForm($form);
     }
     $existingUsernameOrEmail = false;
     $oldUsername = $this->targetUser->username;
     $newUsername = $form->getValue('username');
     if ($isNewUser && $this->_usernameAlreadyExists($newUsername) || !$isNewUser && $oldUsername != $newUsername && $this->_usernameAlreadyExists($newUsername)) {
         $form->username->addError($this->view->translate('This username is already in use'));
         $existingUsernameOrEmail = true;
     }
     $newEmail = $form->getValue('email');
     if ($isNewUser && $this->_emailAlreadyExists($newEmail) || !$isNewUser && $this->targetUser->email != $newEmail && $this->_emailAlreadyExists($newEmail)) {
         $form->email->addError($this->view->translate('This E-mail is already in use'));
         $existingUsernameOrEmail = true;
     }
     if ($existingUsernameOrEmail) {
         return $this->_redirectInvalidForm($form);
     }
     if ($this->_config->yubikey->enabled) {
         $this->targetUser->auth_type = $form->getValue('authMethod');
         $yubikey = trim($form->getValue('yubikey'));
         if ($form->getValue('authMethod') == Users_Model_User::AUTH_YUBIKEY) {
             // only store or update yubikey for new users or existing that filled in something
             if ($isNewUser || $yubikey) {
                 if (!($publicId = $this->_getYubikeyPublicId($yubikey))) {
                     $form->yubikey->addError($this->view->translate('Could not validate Yubikey'));
                     return $this->_redirectInvalidForm($form);
                 }
                 $this->targetUser->yubikey_publicid = $publicId;
             }
         }
     }
     $this->targetUser->username = $newUsername;
     $this->targetUser->firstname = $form->getValue('firstname');
     $this->targetUser->lastname = $form->getValue('lastname');
     $this->targetUser->email = $newEmail;
     if ($isNewUser) {
         $this->targetUser->accepted_eula = 1;
         $this->targetUser->registration_date = date('Y-m-d');
         preg_match('#(.*)/users/profile.*#', Zend_OpenId::selfURL(), $matches);
         $this->targetUser->generateOpenId($matches[1]);
         $this->targetUser->role = Users_Model_User::ROLE_REGISTERED;
         $this->targetUser->setClearPassword($form->getValue('password1'));
     }
     if ($this->_config->ldap->enabled && $this->_config->ldap->keepRecordsSynced) {
         $ldap = Monkeys_Ldap::getInstance();
         if ($isNewUser) {
             $this->targetUser->setPassword($form->getValue('password1'));
             $ldap->add($this->targetUser);
         } else {
             if ($oldUsername != $newUsername) {
                 $ldap->modifyUsername($this->targetUser, $oldUsername);
             }
             $ldap->modify($this->targetUser);
         }
         // LDAP passwords must not be stored in the DB
         $this->targetUser->setPassword('');
     }
     $this->targetUser->save();
     if ($isNewUser) {
         $this->targetUser->createDefaultProfile($this->view);
     }
     /**
      * When the form is submitted through a YUI request using a file, an iframe is used,
      * so the framework doesn't detected it as ajax, so we have to manually ensure the 
      * layout is not shown.
      */
     $this->_helper->layout->disableLayout();
     $this->_forward('accountinfo', null, null, array('userid' => $this->targetUser->id));
 }
开发者ID:sdgdsffdsfff,项目名称:auth-center,代码行数:79,代码来源:ProfilegeneralController.php



注:本文中的Zend_OpenId类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Zend_OpenId_Extension类代码示例发布时间:2022-05-23
下一篇:
PHP Zend_Oauth_Http_Utility类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap