Jump to:

23361 Posts in 18124 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » $LoginForm

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

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

Page: 1
Go to End
Author Topic: 1690 Views
  • Briohny
    Avatar
    Community Member
    199 Posts

    $LoginForm Link to this post

    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>

  • Briohny
    Avatar
    Community Member
    199 Posts

    Re: $LoginForm Link to this post

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

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: $LoginForm Link to this post

    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

  • Briohny
    Avatar
    Community Member
    199 Posts

    Re: $LoginForm Link to this post

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

  • TerryMiddleton
    Avatar
    Community Member
    108 Posts

    Re: $LoginForm Link to this post

    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

  • anujkryadav
    Avatar
    Community Member
    30 Posts

    Re: $LoginForm Link to this post

    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

    1690 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.