Force schema in CWebUser->loginUrl

Hi guys,

How would you force the login page to always appear with HTTP (never HTTPS) schema?

Only solution I have come up with is to copy and override CWebUser::loginRequired method and replace the line:

  $url=$app->createUrl($route,array_splice($url,1));

with

  $url=$app->createAbsoluteUrl($route,array_splice($url,1), ‘http’);

But this seems like overkill(?).  Any ideas?

Tnx

You can configure in app config the 'user' component by setting its 'loginUrl' to be the absolute URL you want.

We don't want a full (absolute) URL put into config file, because we install the webapp on all different servers and will have to keep changing the config each time.

A programmatic solution is preferable.

If that's the case, you should override loginRequired() as you described:



public function loginRequired()


{


	if(is_array($this->loginUrl))


		$this->loginUrl=Yii::app->createAbsoluteUrl($route,array_splice($url,1),'http');


	parent::loginRequired();


}


Perfect, that's neater than what I had.  Tnx