mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Allowing Security controller methods to work without Page or Page_Controller classes (now moved to 'cms' module)
This commit is contained in:
parent
d93025d668
commit
e1b249d0d8
@ -83,6 +83,8 @@ class Security extends Controller {
|
|||||||
*/
|
*/
|
||||||
protected static $wordlist = './wordlist.txt';
|
protected static $wordlist = './wordlist.txt';
|
||||||
|
|
||||||
|
static $template = 'BlankPage';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Template thats used to render the pages.
|
* Template thats used to render the pages.
|
||||||
*
|
*
|
||||||
@ -339,15 +341,20 @@ class Security extends Controller {
|
|||||||
Requirements::css($customCSS);
|
Requirements::css($customCSS);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmpPage = new Page();
|
if(class_exists('SiteTree')) {
|
||||||
$tmpPage->Title = _t('Security.LOGIN', 'Log in');
|
$tmpPage = new Page();
|
||||||
$tmpPage->URLSegment = "Security";
|
$tmpPage->Title = _t('Security.LOGIN', 'Log in');
|
||||||
// Disable ID-based caching of the log-in page by making it a random number
|
$tmpPage->URLSegment = "Security";
|
||||||
$tmpPage->ID = -1 * rand(1,10000000);
|
// Disable ID-based caching of the log-in page by making it a random number
|
||||||
|
$tmpPage->ID = -1 * rand(1,10000000);
|
||||||
|
|
||||||
|
$controller = new Page_Controller($tmpPage);
|
||||||
|
$controller->init();
|
||||||
|
//Controller::$currentController = $controller;
|
||||||
|
} else {
|
||||||
|
$controller = $this;
|
||||||
|
}
|
||||||
|
|
||||||
$controller = new Page_Controller($tmpPage);
|
|
||||||
$controller->init();
|
|
||||||
//Controller::$currentController = $controller;
|
|
||||||
|
|
||||||
$content = '';
|
$content = '';
|
||||||
$forms = $this->GetLoginForms();
|
$forms = $this->GetLoginForms();
|
||||||
@ -436,12 +443,16 @@ class Security extends Controller {
|
|||||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js');
|
Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js');
|
||||||
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/scriptaculous/effects.js');
|
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/scriptaculous/effects.js');
|
||||||
|
|
||||||
$tmpPage = new Page();
|
if(class_exists('SiteTree')) {
|
||||||
$tmpPage->Title = _t('Security.LOSTPASSWORDHEADER', 'Lost Password');
|
$tmpPage = new Page();
|
||||||
$tmpPage->URLSegment = 'Security';
|
$tmpPage->Title = _t('Security.LOSTPASSWORDHEADER', 'Lost Password');
|
||||||
$tmpPage->ID = -1; // Set the page ID to -1 so we dont get the top level pages as its children
|
$tmpPage->URLSegment = 'Security';
|
||||||
$controller = new Page_Controller($tmpPage);
|
$tmpPage->ID = -1; // Set the page ID to -1 so we dont get the top level pages as its children
|
||||||
$controller->init();
|
$controller = new Page_Controller($tmpPage);
|
||||||
|
$controller->init();
|
||||||
|
} else {
|
||||||
|
$controller = $this;
|
||||||
|
}
|
||||||
|
|
||||||
$customisedController = $controller->customise(array(
|
$customisedController = $controller->customise(array(
|
||||||
'Content' =>
|
'Content' =>
|
||||||
@ -495,12 +506,16 @@ class Security extends Controller {
|
|||||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js');
|
Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js');
|
||||||
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/scriptaculous/effects.js');
|
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/scriptaculous/effects.js');
|
||||||
|
|
||||||
$tmpPage = new Page();
|
if(class_exists('SiteTree')) {
|
||||||
$tmpPage->Title = _t('Security.LOSTPASSWORDHEADER');
|
$tmpPage = new Page();
|
||||||
$tmpPage->URLSegment = 'Security';
|
$tmpPage->Title = _t('Security.LOSTPASSWORDHEADER');
|
||||||
$tmpPage->ID = -1; // Set the page ID to -1 so we dont get the top level pages as its children
|
$tmpPage->URLSegment = 'Security';
|
||||||
$controller = new Page_Controller($tmpPage);
|
$tmpPage->ID = -1; // Set the page ID to -1 so we dont get the top level pages as its children
|
||||||
$controller->init();
|
$controller = new Page_Controller($tmpPage);
|
||||||
|
$controller->init();
|
||||||
|
} else {
|
||||||
|
$controller = $this;
|
||||||
|
}
|
||||||
|
|
||||||
$email = Convert::raw2xml($request->param('ID') . '.' . $request->getExtension());
|
$email = Convert::raw2xml($request->param('ID') . '.' . $request->getExtension());
|
||||||
|
|
||||||
@ -541,12 +556,16 @@ class Security extends Controller {
|
|||||||
* @return string Returns the "change password" page as HTML code.
|
* @return string Returns the "change password" page as HTML code.
|
||||||
*/
|
*/
|
||||||
public function changepassword() {
|
public function changepassword() {
|
||||||
$tmpPage = new Page();
|
if(class_exists('SiteTree')) {
|
||||||
$tmpPage->Title = _t('Security.CHANGEPASSWORDHEADER', 'Change your password');
|
$tmpPage = new Page();
|
||||||
$tmpPage->URLSegment = 'Security';
|
$tmpPage->Title = _t('Security.CHANGEPASSWORDHEADER', 'Change your password');
|
||||||
$tmpPage->ID = -1; // Set the page ID to -1 so we dont get the top level pages as its children
|
$tmpPage->URLSegment = 'Security';
|
||||||
$controller = new Page_Controller($tmpPage);
|
$tmpPage->ID = -1; // Set the page ID to -1 so we dont get the top level pages as its children
|
||||||
$controller->init();
|
$controller = new Page_Controller($tmpPage);
|
||||||
|
$controller->init();
|
||||||
|
} else {
|
||||||
|
$controller = $this;
|
||||||
|
}
|
||||||
|
|
||||||
// First load with hash: Redirect to same URL without hash to avoid referer leakage
|
// First load with hash: Redirect to same URL without hash to avoid referer leakage
|
||||||
if(isset($_REQUEST['h']) && Member::member_from_autologinhash($_REQUEST['h'])) {
|
if(isset($_REQUEST['h']) && Member::member_from_autologinhash($_REQUEST['h'])) {
|
||||||
@ -935,4 +954,3 @@ class Security extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user