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:
Ingo Schommer 2007-09-14 19:13:12 +00:00
parent fbc375a282
commit b5156e26ae
7 changed files with 95 additions and 9 deletions

View File

@ -40,6 +40,14 @@ abstract class Authenticator extends Object
* method * method
*/ */
public abstract static function getLoginForm(Controller $controller); 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
View 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();
}
?>

View File

@ -55,6 +55,16 @@ class MemberAuthenticator extends Authenticator {
public static function getLoginForm(Controller $controller) { public static function getLoginForm(Controller $controller) {
return Object::create("MemberLoginForm", $controller, "LoginForm"); 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";
}
} }
?> ?>

View File

@ -9,7 +9,7 @@
/** /**
* Log-in form for the "member" authentication method * Log-in form for the "member" authentication method
*/ */
class MemberLoginForm extends Form { class MemberLoginForm extends LoginForm {
/** /**
* Constructor * Constructor
@ -49,12 +49,12 @@ class MemberLoginForm extends Form {
} else { } else {
if(!$fields) { if(!$fields) {
$fields = new FieldSet( $fields = new FieldSet(
new HiddenField("AuthenticationMethod", null, "Member"), new HiddenField("AuthenticationMethod", null, "Member", $this),
new TextField("Email", "Email address", new TextField("Email", "Email address",
Session::get('SessionForms.MemberLoginForm.Email')), Session::get('SessionForms.MemberLoginForm.Email'), null, $this),
new EncryptField("Password", "Password"), new EncryptField("Password", "Password", null, $this),
new CheckboxField("Remember", "Remember me next time?", new CheckboxField("Remember", "Remember me next time?",
Session::get('SessionForms.MemberLoginForm.Remember')) Session::get('SessionForms.MemberLoginForm.Remember'), $this)
); );
} }
if(!$actions) { 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;
}
} }

View File

@ -147,6 +147,16 @@ class OpenIDAuthenticator extends Authenticator {
public static function getLoginForm(Controller $controller) { public static function getLoginForm(Controller $controller) {
return Object::create("OpenIDLoginForm", $controller, "LoginForm"); 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";
}
} }

View File

@ -13,7 +13,7 @@
* *
* @author Markus Lanthaler <markus@silverstripe.com> * @author Markus Lanthaler <markus@silverstripe.com>
*/ */
class OpenIDLoginForm extends Form { class OpenIDLoginForm extends LoginForm {
/** /**
* Constructor * Constructor
@ -54,9 +54,9 @@ class OpenIDLoginForm extends Form {
$fields = new FieldSet( $fields = new FieldSet(
new HiddenField("AuthenticationMethod", null, "OpenID"), new HiddenField("AuthenticationMethod", null, "OpenID"),
new TextField("OpenIDURL", "OpenID URL", new TextField("OpenIDURL", "OpenID URL",
Session::get('SessionForms.OpenIDLoginForm.OpenIDURL')), Session::get('SessionForms.OpenIDLoginForm.OpenIDURL'), null, $this),
new CheckboxField("Remember", "Remember me next time?", new CheckboxField("Remember", "Remember me next time?",
Session::get('SessionForms.OpenIDLoginForm.Remember')) Session::get('SessionForms.OpenIDLoginForm.Remember'), $this)
); );
} }
if(!$actions) { if(!$actions) {
@ -124,6 +124,20 @@ class OpenIDLoginForm extends Form {
$s = new Security(); $s = new Security();
$s->logout(); $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;
}
} }

View File

@ -164,7 +164,12 @@ class Security extends Controller {
Requirements::javascript("jsparty/prototype_improvements.js"); Requirements::javascript("jsparty/prototype_improvements.js");
Requirements::javascript("jsparty/scriptaculous/effects.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->Title = "Log in";
$tmpPage->URLSegment = "Security"; $tmpPage->URLSegment = "Security";