by Kavitamin » Sat Oct 20, 2012 11:24 am
Hi Alec,
I'm not so familiar with programming spiel, but the section i think you were referring to reads: Apologies for pasting it all out, i just don't know which parts i should be looking at. Any help as always would be much appreciated. There is more text in this file but didn't want to take up the whole blog:
import('classes.handler.Handler');
class PKPLoginHandler extends Handler {
/**
* Display user login form.
* Redirect to user index page if user is already validated.
*/
function index() {
$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();
}
$sessionManager =& SessionManager::getManager();
$session =& $sessionManager->getUserSession();
$templateMgr =& TemplateManager::getManager();
// If the user wasn't expecting a login page, i.e. if they're new to the
// site and want to submit a paper, it helps to explain why they need to
// register.
if(Request::getUserVar('loginMessage'))
$templateMgr->assign('loginMessage', Request::getUserVar('loginMessage'));
$templateMgr->assign('username', $session->getSessionVar('username'));
$templateMgr->assign('remember', Request::getUserVar('remember'));
$templateMgr->assign('source', Request::getUserVar('source'));
$templateMgr->assign('showRemember', Config::getVar('general', 'session_lifetime') > 0);
// For force_login_ssl with base_url[...]: make sure SSL used for login form
$loginUrl = $this->_getLoginUrl();
if (Config::getVar('security', 'force_login_ssl')) {
$loginUrl = String::regexp_replace('/^http:/', 'https:', $loginUrl);
}
$templateMgr->assign('loginUrl', $loginUrl);
$templateMgr->display('user/login.tpl');
}
/**
* Handle login when implicitAuth is enabled.
* If the user came in on a non-ssl url - then redirect back to the ssl url
*/
function implicitAuthLogin() {
if (Request::getProtocol() != 'https')
PKPRequest::redirectSSL();
$wayf_url = Config::getVar("security", "implicit_auth_wayf_url");
if ($wayf_url == "")
die("Error in implicit authentication. WAYF URL not set in config file.");
$url = $wayf_url . "?target=https://" . Request::getServerHost() . Request::getBasePath() . '/index.php/index/login/implicitAuthReturn';
PKPRequest::redirectUrl($url);
}
/**
* This is the function that Shibboleth redirects to - after the user has authenticated.
*/
function implicitAuthReturn() {
$this->validate();
if (Validation::isLoggedIn()) {
PKPRequest::redirect(null, 'user');
}
// Login - set remember to false
$user = Validation::login(Request::getUserVar('username'), Request::getUserVar('password'), $reason, false);
PKPRequest::redirect(null, 'user');