mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
mlanthaler:
Login forms are now styled and use the tabstrip library. Make sure you create a CSS file "tabs.css" in your mysite/css folder with the following content, otherwise the tabs will be without border. Maybe it would be a good idea to create a mysite gsoc branch for changes like this. Will post that issue in the forum. div.tab { clear: left; overflow: auto; border: 1px #AAA solid; border-top: none; position: relative; top: -3px; margin: 0; padding: 10px; /*width: 98%;*/ } div.tabset { border: 1px solid #fff; /* Hack for FF1.5/Win Float-Bug */ clear: left; margin: 0; } ul.tabstrip li { margin-left: 0; } (merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@41786 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
fbc375a282
commit
b5156e26ae
@ -40,6 +40,14 @@ abstract class Authenticator extends Object
|
||||
* method
|
||||
*/
|
||||
public abstract static function getLoginForm(Controller $controller);
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the authentication method
|
||||
*
|
||||
* @return string Returns the name of the authentication method.
|
||||
*/
|
||||
public abstract static function getName();
|
||||
}
|
||||
|
||||
?>
|
28
security/LoginForm.php
Normal file
28
security/LoginForm.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LoginForm base class
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Abstract base class for a login form
|
||||
*
|
||||
* This class is used as a base class for the different log-in forms like
|
||||
* {@link MemberLoginForm} or {@link OpenIDLoginForm}.
|
||||
*
|
||||
* @author Markus Lanthaler <markus@silverstripe.com>
|
||||
*/
|
||||
abstract class LoginForm extends Form
|
||||
{
|
||||
/**
|
||||
* Get the authenticator class
|
||||
*
|
||||
* @return Authenticator Returns the authenticator class for this login
|
||||
* form.
|
||||
*/
|
||||
public abstract static function getAuthenticator();
|
||||
}
|
||||
|
||||
?>
|
@ -55,6 +55,16 @@ class MemberAuthenticator extends Authenticator {
|
||||
public static function getLoginForm(Controller $controller) {
|
||||
return Object::create("MemberLoginForm", $controller, "LoginForm");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the authentication method
|
||||
*
|
||||
* @return string Returns the name of the authentication method.
|
||||
*/
|
||||
public static function getName() {
|
||||
return "Default login method";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -9,7 +9,7 @@
|
||||
/**
|
||||
* Log-in form for the "member" authentication method
|
||||
*/
|
||||
class MemberLoginForm extends Form {
|
||||
class MemberLoginForm extends LoginForm {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -49,12 +49,12 @@ class MemberLoginForm extends Form {
|
||||
} else {
|
||||
if(!$fields) {
|
||||
$fields = new FieldSet(
|
||||
new HiddenField("AuthenticationMethod", null, "Member"),
|
||||
new HiddenField("AuthenticationMethod", null, "Member", $this),
|
||||
new TextField("Email", "Email address",
|
||||
Session::get('SessionForms.MemberLoginForm.Email')),
|
||||
new EncryptField("Password", "Password"),
|
||||
Session::get('SessionForms.MemberLoginForm.Email'), null, $this),
|
||||
new EncryptField("Password", "Password", null, $this),
|
||||
new CheckboxField("Remember", "Remember me next time?",
|
||||
Session::get('SessionForms.MemberLoginForm.Remember'))
|
||||
Session::get('SessionForms.MemberLoginForm.Remember'), $this)
|
||||
);
|
||||
}
|
||||
if(!$actions) {
|
||||
@ -184,6 +184,17 @@ class MemberLoginForm extends Form {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the authenticator class
|
||||
*
|
||||
* @return Authenticator Returns the authenticator class for this login
|
||||
* form.
|
||||
*/
|
||||
public static function getAuthenticator() {
|
||||
return new MemberAuthenticator;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -147,6 +147,16 @@ class OpenIDAuthenticator extends Authenticator {
|
||||
public static function getLoginForm(Controller $controller) {
|
||||
return Object::create("OpenIDLoginForm", $controller, "LoginForm");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the authentication method
|
||||
*
|
||||
* @return string Returns the name of the authentication method.
|
||||
*/
|
||||
public static function getName() {
|
||||
return "OpenID/i-name";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @author Markus Lanthaler <markus@silverstripe.com>
|
||||
*/
|
||||
class OpenIDLoginForm extends Form {
|
||||
class OpenIDLoginForm extends LoginForm {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -54,9 +54,9 @@ class OpenIDLoginForm extends Form {
|
||||
$fields = new FieldSet(
|
||||
new HiddenField("AuthenticationMethod", null, "OpenID"),
|
||||
new TextField("OpenIDURL", "OpenID URL",
|
||||
Session::get('SessionForms.OpenIDLoginForm.OpenIDURL')),
|
||||
Session::get('SessionForms.OpenIDLoginForm.OpenIDURL'), null, $this),
|
||||
new CheckboxField("Remember", "Remember me next time?",
|
||||
Session::get('SessionForms.OpenIDLoginForm.Remember'))
|
||||
Session::get('SessionForms.OpenIDLoginForm.Remember'), $this)
|
||||
);
|
||||
}
|
||||
if(!$actions) {
|
||||
@ -124,6 +124,20 @@ class OpenIDLoginForm extends Form {
|
||||
$s = new Security();
|
||||
$s->logout();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the authenticator class
|
||||
*
|
||||
* <strong>Attention: This method will return the class and not an
|
||||
* instance of the authenticator class!</strong>
|
||||
*
|
||||
* @return Authenticator Returns the authenticator class for this login
|
||||
* form.
|
||||
*/
|
||||
public static function getAuthenticator() {
|
||||
return new OpenIDAuthenticator;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -164,7 +164,12 @@ class Security extends Controller {
|
||||
Requirements::javascript("jsparty/prototype_improvements.js");
|
||||
Requirements::javascript("jsparty/scriptaculous/effects.js");
|
||||
|
||||
$tmpPage = DataObject::get_one('Page', "URLSegment = 'home'");
|
||||
$customCSS = project() . '/css/tabs.css';
|
||||
if(Director::fileExists($customCSS)) {
|
||||
Requirements::css($customCSS);
|
||||
}
|
||||
|
||||
$tmpPage = new Page();
|
||||
$tmpPage->Title = "Log in";
|
||||
$tmpPage->URLSegment = "Security";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user