本文整理汇总了PHP中Authentication::getSessionId方法的典型用法代码示例。如果您正苦于以下问题:PHP Authentication::getSessionId方法的具体用法?PHP Authentication::getSessionId怎么用?PHP Authentication::getSessionId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authentication
的用法示例。
在下文中一共展示了Authentication::getSessionId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Login
function Login($user_name, $password = NULL, $type = 'USER_NAME')
{
global $config_vars;
$authentication = new Authentication();
Debug::text('User Name: ' . $user_name . ' Password Length: ' . strlen($password) . ' Type: ' . $type, __FILE__, __LINE__, __METHOD__, 10);
//FIXME: When using Flex, I think it sets the cookie itself, so we need to pass this information on to it before it will actually work.
//However this should work fine for JSON/SOAP.
//FIXME: Store the type in the authentication table so we know how the user logged in. Then we can disable certain functionality if using the phone_id.
if (isset($config_vars['other']['web_session_expire']) and $config_vars['other']['web_session_expire'] != '') {
$authentication->setEnableExpireSession((int) $config_vars['other']['web_session_expire']);
}
if ($authentication->Login($user_name, $password, $type) === TRUE) {
$retval = $authentication->getSessionId();
Debug::text('Success, Session ID: ' . $retval, __FILE__, __LINE__, __METHOD__, 10);
return $retval;
} else {
$validator_obj = new Validator();
$validator_stats = array('total_records' => 1, 'valid_records' => 0);
$error_column = 'user_name';
$error_message = TTi18n::gettext('User Name or Password is incorrect');
//Get company status from user_name, so we can display messages for ONHOLD/Cancelled accounts.
$clf = TTnew('CompanyListFactory');
$clf->getByUserName($user_name);
if ($clf->getRecordCount() > 0) {
$c_obj = $clf->getCurrent();
if ($c_obj->getStatus() == 20) {
$error_message = TTi18n::gettext('Sorry, your company\'s account has been placed ON HOLD, please contact customer support immediately');
} elseif ($c_obj->getStatus() == 23) {
$error_message = TTi18n::gettext('Sorry, your trial period has expired, please contact our sales department to reactivate your account');
} elseif ($c_obj->getStatus() == 28) {
if ($c_obj->getMigrateURL() != '') {
$error_message = TTi18n::gettext('To better serve our customers your account has been migrated, please update your bookmarks to use the following URL from now on: ') . 'http://' . $c_obj->getMigrateURL();
} else {
$error_message = TTi18n::gettext('To better serve our customers your account has been migrated, please contact customer support immediately.');
}
} elseif ($c_obj->getStatus() == 30) {
$error_message = TTi18n::gettext('Sorry, your company\'s account has been CANCELLED, please contact customer support if you believe this is an error');
} elseif ($c_obj->getPasswordPolicyType() == 1 and $c_obj->getProductEdition() > 10) {
//Password policy is enabled, confirm users password has not exceeded maximum age.
$ulf = TTnew('UserListFactory');
$ulf->getByUserName($user_name);
if ($ulf->getRecordCount() > 0) {
foreach ($ulf as $u_obj) {
//Make sure we confirm that the password is in fact correct, but just expired.
if ($u_obj->checkPassword($password, FALSE) == TRUE and $u_obj->checkPasswordAge() == FALSE) {
$error_message = TTi18n::gettext('Sorry, your password has exceeded its maximum age specified by your company\'s password policy and must be changed immediately');
$error_column = 'password';
}
}
}
unset($ulf, $u_obj);
}
}
$validator_obj->isTrue($error_column, FALSE, $error_message);
$validator[0] = $validator_obj->getErrorsArray();
return $this->returnHandler(FALSE, 'VALIDATION', TTi18n::getText('INVALID DATA'), $validator, $validator_stats);
}
return $this->returnHandler(FALSE);
}
示例2: Login
function Login($user_name, $password = NULL, $type = NULL)
{
$authentication = new Authentication();
Debug::text('User Name: ' . $user_name . ' Password Length: ' . strlen($password) . ' Type: ' . $type, __FILE__, __LINE__, __METHOD__, 10);
if ($authentication->Login($user_name, $password, $type) === TRUE) {
$retval = $authentication->getSessionId();
Debug::text('Success, Session ID: ' . $retval, __FILE__, __LINE__, __METHOD__, 10);
return $retval;
}
return FALSE;
}