I extended MemberLoginForm similar to like the old SSbits tutorial for client redirection http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/
But is it possible to have 2 login forms, instead of overriding? The reason being, I want 1 form for admin logins, and the custom form for the client redirection since they will never need CMS access. I realize the SSbits tutorial takes it into account, but I'd rather keep it simple since none of the client logins will need access and I"m curious for my own knowledge. If not, I can just do it similar to how SSBits handles it.
Ideally I want to create a client login page and put the custom form on it. Is there a way to attach the extended form to my pagetype and have a variable like $CustomLoginForm in my template? Something like that.
CustomLoginForm.php
<?php
class CustomLoginForm extends MemberLoginForm {
public function dologin($data) {
if($this->performLogin($data)) {
if(!$this->redirectByClient($data))
Controller::curr()->redirect(Director::baseURL());
} else {
if($badLoginURL = Session::get('BadLoginURL')) {
Controller::curr()->redirect($badLoginURL);
} else {
Controller::curr()->redirectBack();
}
}
}
public function redirectByClient($data) {
$member = Member::currentUser();
if ($member && $Page = $member->ClientPage()) {
return Controller::curr()->redirect($Page->Link());
}
return false;
}
}