Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

 9 Answer(s)

  • Please use this code for Login:-

    public function login() {
                if ($this->Session->read('Auth.User')) {
                    $this->Session->setFlash('You are logged in!');
                    return $this->redirect('/');
                }
                if ($this->request->is('post')) {
                    if ($this->Auth->login()) {
                        return $this->redirect($this->Auth->redirect());
                    }
                    $this->Session->setFlash(__('Your username or password was incorrect.'));
                }
            }
    

    Please check and let me know if it works
    Thanks

  • Hi tvellaisa

    You will have to set the session.cookie_secure is false
    Please use this code

    Configure::write('Session', array(
        'defaults' => 'php',
        'ini' => array(
            'session.cookie_secure' => false
        )
    ));
    

    I hope you are using Session and storing message in Session while submitting the form with the piece of code:-

     $this->Session->write('variable', 'value'); 

    After Submitting wherever you need to display put the code

    echo $this->Session->flash();

    Please check and let me know, if it works
    Thanks

  • Hi tvellaisa

    Please find the path in your cakephp project folder

    app/webroot/.htaccess and /app/.htaccess and delete these files

    Now Open .htaccess file inside your project folder e.g(project_folder/.htaccess) and modify the code in it

        RewriteEngine on
        RewriteCond %{SERVER_PORT} !^443$
        RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
    

    Disable URL-Rewriting

    write the code

        Configure::write('App.baseUrl', env('SCRIPT_NAME'));
    

    Please check and let me know if it works
    Thanks

  • Hello tvellaisa,

    You can do the same using by adding Security component in your controller. Eg.

        class WidgetController extends AppController {
    
        public $components = array('Security');
    
        public function beforeFilter() {
            if (isset($this->params['admin'])) {
                $this->Security->blackHoleCallback = 'forceSSL';
                $this->Security->requireSecure();
            }
        }
    
        public function forceSSL() {
            return $this->redirect('https://' . env('SERVER_NAME') . $this->here);
        }
    }
    

    Please see cakephp document regarding this. http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html

    I hope using above example will fix your issue.

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: