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.

Archive /

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

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

Custom Login Form


Go to End
Reply


11 Posts   8417 Views

Avatar
Liam

Community Member, 470 Posts

22 August 2008 at 11:28am

Edited: 22/08/2008 11:32am

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.

Avatar
Liam

Community Member, 470 Posts

25 August 2008 at 3:42pm

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.

Avatar
grilldan

Community Member, 135 Posts

25 August 2008 at 4:38pm

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

Avatar
Liam

Community Member, 470 Posts

28 August 2008 at 1:59pm

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.

Avatar
peterellis

Community Member, 1 Post

2 September 2008 at 3:42am

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!

Avatar
Liam

Community Member, 470 Posts

2 September 2008 at 4:01am

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.

Avatar
moloko_man

Community Member, 72 Posts

2 September 2008 at 10:06am

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!

Avatar
Liam

Community Member, 470 Posts

2 September 2008 at 10:10am

Edited: 03/09/2008 1:49am

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.

Go to Top