Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Custom Login Form

Our old forums are still available as a read-only archive.

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

Page: 1 2
Go to End
Author Topic: 8075 Views
  • Liam
    Avatar
    Community Member
    470 Posts

    Custom Login Form Link to this post

    I have a site that has a private client area. Members will be created manually by the admin, and users will have no access to the CMS.

    I need a login form to appear in my template in the header of every page. I can use $LoginForm which works pretty good, except I'd like to redirect the login of only that special $LoginForm.

    I looked up the page on overriding the login form in the documentation and saw I can use Object::useCustomClass(), except to my understanding it overrides all the login forms including the one at domain.com/admin/

    Is it possible to just have that one specific login form in the header handle a different redirect?

    Don't think this is possible, but:

    I have a page setup like so

    - client area
    ----- client 1
    ---------- client 1 page 1
    ---------- client 1 page 2
    ----- client 2
    ---------- client 2 page 1
    ---------- client 2 page 2
    etc etc


    Is it possible to redirect the user after login to their specific parent page? I'd like to do this without hard coding in the values for ease of future use. Clients will be added all the time.

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Custom Login Form Link to this post

    Okay, lets keep it simple. I'll deal with the redirect issue later as I don't think I have an option for that.

    But how do I create a login form that will redirect to a different area beside the admin panel, without overriding the admin login form. I basically want 2 different ones. The domain.com/admin to go to the admin side, and another one in my template that will just go to a page.

  • grilldan
    Avatar
    Community Member
    135 Posts

    Re: Custom Login Form Link to this post

    I'm a little confused on what your trying to do, but you might be able to do this with a meta tag redirect.

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Custom Login Form Link to this post

    What I'm looking at doing is having a login form displayed on every page in my template - on the public side of the website. Possibly using $LoginForm

    Users will login but I want them redirected to a client page, not the admin panel since they won't be using the back end site. I'm setting up a private area for them.

    I know I could override/extend the MemberLoginForm class, but then my original login form located at domain.com/admin will take on these properties as well. I do not want this. I'd prefer 2 separate login forms.

    Is this at all possible?

    In summary, I want administrators to login at domain.com/admin/ and be redirected to the admin panel, but users who login at a form on the front end of the website, be redirected to a fixed client page.

  • peterellis
    Avatar
    Community Member
    1 Post

    Re: Custom Login Form Link to this post

    I understand what your trying to do as I am currently in the same position. Classically one would implement a database of members and create a form for logging in a member or allowing a new member to register. Im quite new to SilverStripe but a tutorial on this would be great!

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Custom Login Form Link to this post

    As of now, I'm just going to look at the outputted html code from the $LoginForm and include that in a .ss template. I'll change the form action to just go to a different page other than /admin. I believe this will work though I'll know for sure when I complete it this week. Not as dynamic as I'd like, but it'll have to do for now.

  • moloko_man
    Avatar
    Community Member
    72 Posts

    Re: Custom Login Form Link to this post

    I'm trying to do the same thing. If you get done before me, do you mind posting your code? I'll post mine if I figure it out before you.

    Its a race!

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Custom Login Form Link to this post

    lol it's on!

    I might work on it tonight. I had to port the site over from another CMS and I'm leaving this member thing till the end. Pretty much everything is done except some minor sub nav stuff, so it should be today or tomorrow.

    If you look in the widgets page, there is a widget for a login form. Doesn't do what we're after, but has all the code lined up in the template. Could be a start.

    8075 Views
Page: 1 2
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.