Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

$LoginForm


Go to End


6 Posts   2157 Views

Avatar
Briohny

Community Member, 199 Posts

21 February 2009 at 1:59am

Edited: 21/02/2009 2:28am

Hello!

I'm using the $LoginForm in my template as follows:

<% if CurrentMember %> 
You're logged in as: $CurrentMember.FirstName 
<% else %> 
$LoginForm 
<% end_if %>

1) Where do i edit the CSS for this?
2) It has an email & password field and a 'login' and 'i've lost my password' button. When logged in, i would like the user to have a 'logout' option. How do i create this? Is there something like a $Logout piece of code?

Many thanks in advance!

edit: I ended up just adding the following code to log out:

<a href="Security/logout"><h3>LOG OUT</h3></a>

Avatar
Briohny

Community Member, 199 Posts

21 February 2009 at 2:04am

Sorry... I see that this form uses the same CSS as the cms/admin. Is it possible to have them looking different?

Avatar
Carbon Crayon

Community Member, 598 Posts

21 February 2009 at 5:09am

you could wrap the $LoginForm in a div:

<div id="customLoginForm">
$LoginForm
</div>

and then use that selector to syle the fields:

div#customLoginForm fieldset label{
//custom style
}

Probably the easiest way to approach it would be to copy all the styles that apply to the login form and then just add #customLoginForm inform of them and start editing, that way you know that it will always have one more selector and so will overwrite the default styling :)

Avatar
Briohny

Community Member, 199 Posts

21 February 2009 at 5:37am

Edited: 21/02/2009 5:37am

Great. Thanks Aram, i'll give that a try.

Avatar
TerryMiddleton

Community Member, 108 Posts

2 April 2009 at 4:03am

Briohny,

Hi. Were you able to gain control over the layout of the $Loginform?

I"m curious how you did this. I need to change the layout of the $Loginform but simply can't get there.

Can you share your thoughts?

Terry Middleton

Avatar
anujkryadav

Community Member, 30 Posts

19 December 2009 at 2:29am

Hello Briohny
thank you for your code,it helped me in creating the link for logout
but when i click on logout link though the session is logged out but it is redirect to the same page,I want to redirect it to home page
Can anyone help me in redirecting to home page after clicking on logout.
Thank you in advance