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

Forcing a Login (SOLVED)


Go to End


1255 Views

Avatar
TerryMiddleton

Community Member, 108 Posts

25 July 2009 at 8:55am

Edited: 30/07/2009 10:46am

*** I figured this out ***

You can force a login by issuing this url:

(site)/Security/LoginForm&action_dologin=1&Email=(email)&Password=(password)

I'm using a CustomLoginForm, but this doesn't work. I get an error:

<error>
Fatal error: Call to a member function getSession() on a non-object in /home/www/sites_on_nfs/public/radimage/htdocs/sapphire/core/Session.php on line 57
</error>

Here is my CustomLoginForm:

<code>
class CustomLoginForm extends MemberLoginForm {

// this function is overloaded on our sublcass (this) to do something different
public function dologin($data) {

$email = Convert::raw2sql($data['Email']);

//$accountenabled = 1; //Convert::raw2sql($data['AccountEnabled']);
//Check to see if member already is in the db using their email address
// $Members = DataObject::get("Member", "Email='$email' and AccountEnabled = '$accountenabled'");
$Members = DataObject::get_one("Member", "Email='$email' AND AccountEnabled = 1");

if ($Members) {
$this->performLogin($data);
Director::redirectBack();
// parent::doLogin($data);
//Director::redirect('home');
} else {
$data = null;
$this->performLogin($data);

Director::redirectBack();

//if member is not enabled - void login
// $data['Password'] = 'no';
// parent::doLogin($data);
// Director::redirect('runqueuea');

}

}//function

} //class

</code>