FEATURE: #3612 - Option to auto-login with basic auth (jshipman)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@72788 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2009-03-10 21:10:07 +00:00 committed by Sam Minnee
parent ad15e09235
commit 70cdd94321

View File

@ -11,6 +11,7 @@ class BasicAuth extends Object {
* @var boolean
*/
static protected $enabled = false;
static protected $autologin = false;
/**
* Require basic authentication. Will request a username and password if none is given.
@ -33,6 +34,9 @@ class BasicAuth extends Object {
if($member) {
$authenticated = true;
if(self::$autologin) {
$member->logIn();
}
}
}
@ -64,10 +68,11 @@ class BasicAuth extends Object {
return $member;
}
static function enable() {
static function enable($auto = false) {
self::$enabled = true;
self::$autologin = $auto;
}
static function disable() {
self::$enabled = false;
}
}
}