本文整理汇总了PHP中UserIdentity::userAuthenticate方法的典型用法代码示例。如果您正苦于以下问题:PHP UserIdentity::userAuthenticate方法的具体用法?PHP UserIdentity::userAuthenticate怎么用?PHP UserIdentity::userAuthenticate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserIdentity
的用法示例。
在下文中一共展示了UserIdentity::userAuthenticate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
parent::init();
if (isset($_GET["src"]) && $_GET["src"] == "ads") {
Yii::app()->session['src'] = 'ads';
}
//get userPhone
if (Yii::app()->user->isGuest) {
$identity = new UserIdentity(null, null);
$type = 'autoLogin';
if ($identity->userAuthenticate($type, $this->deviceOs)) {
Yii::app()->user->login($identity);
}
}
$this->userPhone = Yii::app()->user->getState('msisdn');
$this->banners = WapBannerModel::getBanner('wap');
//chk is subscribe
if (!empty($this->userPhone)) {
$this->isSub = WapUserSubscribeModel::model()->chkIsSubscribe($this->userPhone);
}
if (Yii::app()->user->getState('is3g') == 1) {
$this->is3g = true;
}
$isTouch = $this->_isTouchLayout();
if (!$isTouch) {
$this->layout = 'application.views.wap.layouts.main';
}
}
示例2: init
public function init()
{
/* $log = new KLogger('log_view_error', KLogger::INFO);
$log->LogInfo("viewPath:".$this->getViewPath(), false);
$log->LogInfo("Action:".$this->getAction(), false); */
$isTouch = $this->_isTouchLayout();
if ($isTouch) {
$this->deviceLayout = 'touch';
$this->layout = 'application.views.touch.layouts.main';
if (strpos(Yii::app()->params['base_url'], $_SERVER['HTTP_HOST']) === false) {
$this->redirect(Yii::app()->params['base_url'] . Yii::app()->request->requestUri);
}
} else {
$this->deviceLayout = 'default';
//$this->layout = 'application.views.wap.default.layouts.main';
$this->layout = 'application.modules.event.views.layouts.main';
if (strpos(Yii::app()->params['base_url'], $_SERVER['HTTP_HOST']) === false) {
$this->redirect(Yii::app()->params['base_url'] . Yii::app()->request->requestUri);
}
}
parent::init();
if ($isTouch) {
//get userPhone
if (Yii::app()->user->isGuest) {
$identity = new UserIdentity(null, null);
$type = 'autoLogin';
if ($identity->userAuthenticate($type, $this->deviceOs)) {
Yii::app()->user->login($identity);
$this->userPhone = Yii::app()->user->getState('msisdn');
}
} else {
$this->userPhone = Yii::app()->user->getState('msisdn');
}
$this->banners = BannerModel::getBanner('wap');
$this->userName = Yii::app()->user->getState('username');
//chk is subscribe
if (!empty($this->userPhone)) {
$this->isSub = WapUserSubscribeModel::model()->chkIsSubscribe($this->userPhone);
}
}
}
示例3: init
public function init()
{
// setup multi language
self::_setupLanguage();
// DETECT DEVICE
$this->device = DeviceManager::getInstance();
if (!isset(yii::app()->session['deviceId'])) {
Yii::app()->session['deviceId'] = $this->device->getDeviceID();
Yii::app()->session['device'] = $this->device->getInfo('model_name');
Yii::app()->session['deviceOS'] = $this->device->getDeviceOs();
}
$this->deviceOs = Yii::app()->session['deviceOS'];
// check user login
if (Yii::app()->user->isGuest) {
$identity = new UserIdentity(null, null);
$type = 'autoLogin';
if ($identity->userAuthenticate($type, $this->deviceOs)) {
Yii::app()->user->login($identity);
}
}
// get banners
$this->banners = WapBannerModel::getBanner('wap');
// reload package state if request
if (isset($_REQUEST['reloadPackage']) && $_REQUEST['reloadPackage'] == 1) {
$package = WapUserSubscribeModel::model()->getUserSubscribe(Yii::app()->user->getState('msisdn'));
//get user_subscribe record by phone
if ($package) {
$packageObj = WapPackageModel::model()->findByPk($package->package_id);
Yii::app()->user->setState('package', $packageObj->code);
}
}
$this->promotion_realtime = WapUserSubscribeModel::model()->checkPromotion(Yii::app()->user->getState('msisdn'));
if (!isset(Yii::app()->session['isPromotion']) || Yii::app()->session['isPromotion'] == '') {
if (Yii::app()->user->getState('msisdn')) {
//Yii::app()->session['isPromotion'] = WapUserSubscribeModel::model()->checkPromotion(Yii::app()->user->getState('msisdn'));
Yii::app()->session['isPromotion'] = $this->promotion_realtime;
} else {
Yii::app()->session['isPromotion'] = "";
}
}
$this->isPromotion = Yii::app()->session['isPromotion'];
if (Yii::app()->user->getState('msisdn')) {
$this->userSub = WapUserSubscribeModel::model()->getUserSubscribe(Yii::app()->user->getState('msisdn'));
} else {
$this->userSub = "";
}
Yii::app()->user->setState('userSub', $this->userSub);
if (!Yii::app()->user->isGuest && $this->userSub == '') {
$this->getPopup();
}
$this->getPopupKM();
$this->getPopupCTKM();
// load config from DB
$wap_configs = Yii::app()->cache->get("WAP_CONFIG");
if ($wap_configs === false) {
$wap_configs = ConfigModel::model()->getConfig('', 'wap');
Yii::app()->cache->set("WAP_CONFIG", $wap_configs, Yii::app()->params['cacheTime']);
}
if (!empty($wap_configs)) {
foreach ($wap_configs as $key => $info) {
$config_type = $info['type'];
if ($config_type == "string") {
Yii::app()->params[$key] = $info['value'];
}
if ($config_type == "int") {
Yii::app()->params[$key] = intval($info['value']);
}
if ($config_type == "array") {
Yii::app()->params[$key] = unserialize($info['value']);
}
}
}
$this->updateCache();
return parent::init();
}