本文整理汇总了PHP中PKPRequest::redirectSSL方法的典型用法代码示例。如果您正苦于以下问题:PHP PKPRequest::redirectSSL方法的具体用法?PHP PKPRequest::redirectSSL怎么用?PHP PKPRequest::redirectSSL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PKPRequest
的用法示例。
在下文中一共展示了PKPRequest::redirectSSL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: signIn
/**
* Validate a user's credentials and log the user in.
*/
function signIn()
{
$this->validate();
$this->setupTemplate();
if (Validation::isLoggedIn()) {
PKPRequest::redirect(null, 'user');
}
if (Config::getVar('security', 'force_login_ssl') && Request::getProtocol() != 'https') {
// Force SSL connections for login
PKPRequest::redirectSSL();
}
$user = Validation::login(Request::getUserVar('username'), Request::getUserVar('password'), $reason, Request::getUserVar('remember') == null ? false : true);
if ($user !== false) {
if (Config::getVar('security', 'force_login_ssl') && !Config::getVar('security', 'force_ssl')) {
// Redirect back to HTTP if forcing SSL for login only
PKPRequest::redirectNonSSL();
} else {
if ($user->getMustChangePassword()) {
// User must change their password in order to log in
Validation::logout();
PKPRequest::redirect(null, null, 'changePassword', $user->getUsername());
} else {
$source = Request::getUserVar('source');
if (isset($source) && !empty($source)) {
PKPRequest::redirectUrl(Request::getProtocol() . '://' . Request::getServerHost() . $source, false);
} else {
Request::redirectHome();
}
}
}
} else {
$sessionManager =& SessionManager::getManager();
$session =& $sessionManager->getUserSession();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('username', Request::getUserVar('username'));
$templateMgr->assign('remember', Request::getUserVar('remember'));
$templateMgr->assign('source', Request::getUserVar('source'));
$templateMgr->assign('showRemember', Config::getVar('general', 'session_lifetime') > 0);
$templateMgr->assign('error', $reason === null ? 'user.login.loginError' : ($reason === '' ? 'user.login.accountDisabled' : 'user.login.accountDisabledWithReason'));
$templateMgr->assign('reason', $reason);
$templateMgr->display('user/login.tpl');
}
}