mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
ad15e09235
commit
70cdd94321
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user