Yii Framework Forum: Https + login - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Https + login Configure setting Rate Topic: -----

#1 User is offline   jowen 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 191
  • Joined: 13-July 11
  • Location:Malaysia

Posted 25 June 2012 - 04:36 AM

Hi Guys,


I follow the Jaburo.net. https only allow at login page not overall page. That is good news but somehow it always say can't establish a connection to the server at localhost when i click the https://.../login page and other pages still work fine using http. Anyone face this problem before?

My code below
protected/components/HttpsFilter.php
class HttpsFilter extends CFilter {
    protected function preFilter( $filterChain ) {
        if ( !Yii::app()->getRequest()->isSecureConnection ) {
            # Redirect to the secure version of the page.
            $url = 'https://' .
                Yii::app()->getRequest()->serverName .
                Yii::app()->getRequest()->requestUri;
                Yii::app()->request->redirect($url);
            return false;
        }
        return true;
    }
}


protected/components/Controller.php
class Controller extends CController
{
    public $breadcrumbs=array();
    public function filterHttps( $filterChain ) {
        $filter = new HttpsFilter;
        $filter->filter( $filterChain );
    }
}


controllers/SiteController
public function filters()
{
    return array(
        'https +login', // Force https, but only on login page
    );
}


Helpss is needed. Thx.
0

#2 User is offline   suriyansuresh 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 23-July 10
  • Location:Coimbatore, India

Posted 25 June 2012 - 09:22 AM

View Postjowen, on 25 June 2012 - 04:36 AM, said:

Hi Guys,


I follow the Jaburo.net. https only allow at login page not overall page. That is good news but somehow it always say can't establish a connection to the server at localhost when i click the https://.../login page and other pages still work fine using http. Anyone face this problem before?

My code below
protected/components/HttpsFilter.php
class HttpsFilter extends CFilter {
    protected function preFilter( $filterChain ) {
        if ( !Yii::app()->getRequest()->isSecureConnection ) {
            # Redirect to the secure version of the page.
            $url = 'https://' .
                Yii::app()->getRequest()->serverName .
                Yii::app()->getRequest()->requestUri;
                Yii::app()->request->redirect($url);
            return false;
        }
        return true;
    }
}


protected/components/Controller.php
class Controller extends CController
{
    public $breadcrumbs=array();
    public function filterHttps( $filterChain ) {
        $filter = new HttpsFilter;
        $filter->filter( $filterChain );
    }
}


controllers/SiteController
public function filters()
{
    return array(
        'https +login', // Force https, but only on login page
    );
}


Helpss is needed. Thx.

Your question is not clear, you want https to be enabled in all pages?, What is your server configuration whether you installed ssl in localhost?
Suriyan

Yii application development | Web design
0

#3 User is offline   jowen 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 191
  • Joined: 13-July 11
  • Location:Malaysia

Posted 25 June 2012 - 07:07 PM

Hi suriyansuresh,

Sorry for my bad english. I want user to pass through https:// method for login page and other pages using http. The source for Jaburo net can work but some how it always say can't establish a connection to the server at localhost when i click the https://.../login page.
What is your server configuration whether you installed ssl in localhost? 


I now using apache as server configuration.

Can tell me what is the configuration step for apache if want install ssl in localhost?? I find some method but it still can't work.

Pls helpss.
0

#4 User is offline   jowen 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 191
  • Joined: 13-July 11
  • Location:Malaysia

Posted 27 June 2012 - 07:54 PM

Hi guys,

Anyone know how to solve this problems? Appreciate your help. Thx.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users