tokenly / tokenly-cms

GNU General Public License v2.0
42 stars 12 forks source link

Cannot Login. #91

Closed zono closed 8 years ago

zono commented 8 years ago

Hi I just installed Tokenly CMS.

After I login, the top page is displayed. However still "Login/Register" link is on the top right of screen. It seems not to be login status. And also I cannot see any menus I expected like user setting page, blog entry like that.

If I enter wrong ID or Password, error message is showed. Logging process seems to be OK.

The ID I entered is registered during the installation.

How should I do?

cryptonaut420 commented 8 years ago

Hey there. Can you email me a screenshot of what you see? (and also I can help you get everything set up correctly to match the current LTB site). nick@tokenly.com

zono commented 8 years ago

Thanks for your response. I sent an email to you.

zono commented 8 years ago

I found that it was just redirected to http://MyDomain/ because isset($_SESSION['accountAuth']) was false.

slick/App/Account/DashHome/Controller.php

public function init()
{
  if(isset($_SESSION['accountAuth'])){
    try{
        $userInfo = V1\Auth_Model::getUser(array('authKey' => $_SESSION['accountAuth'], 'site' => $this->data['site']));
    } catch(\Exception $e){
        redirect($this->site.'account/logout');
    }
  } else{
    redirect($this->site);
  }

  $output = parent::init();
  $output['view'] = 'index';
  $output['template'] = 'admin';

  return $output;
}

I'm still looking for where $_SESSION['accountAuth'] become empty.

App_Account Home_Model generateAuthToken saved accountAuth ←←← $_SESSION['accountAuth'] is exist
↓
route account/home ←←← $_SESSION['accountAuth'] is exist
↓
App Controller contruct() ←←← $_SESSION['accountAuth'] is NOT exist
↓
App Controller init() ←←← $_SESSION['accountAuth'] is NOT exist
↓
App AppControl contruct() ←←← $_SESSION['accountAuth'] is NOT exist
↓
App_Account Controller contruct() ←←← $_SESSION['accountAuth'] is NOT exist
↓
App_Account Controller init() ←←← $_SESSION['accountAuth'] is NOT exist
↓
App AppControl init() ←←← $_SESSION['accountAuth'] is NOT exist
↓
ModControl construct() ←←← $_SESSION['accountAuth'] is NOT exist
↓
App_Account DashHome_Controller ←←← $_SESSION['accountAuth'] is NOT exist
↓
redirect http://MyDomain/
zono commented 8 years ago

Fixed it. I put "session_start();" just after "<?php". I don't why...

www/index.php

<?php
session_start();
$startTime = microtime(true);
ini_set('display_errors', 1);
require_once('../conf/config.php');
include(FRAMEWORK_PATH.'/autoload.php');
//setup session cookie to work accross subdomains
$expDomain = explode('.', $_SERVER['HTTP_HOST']);
if(count($expDomain) > 2){
        unset($expDomain[0]);
}
$domainJoin = join('.', $expDomain);
ini_set('session.cookie_domain', '.'.$domainJoin);
//session_start();

http://stackoverflow.com/questions/17242346/php-session-lost-after-redirect

cryptonaut420 commented 8 years ago

:)