i am using the atk4 basic auth so when i login here http://subdomain1.DOMAIN.pk/index.html
i see all the details
you are visiting: subdomain1
your site : subdomain2
This is not your site string(23) "abc@gmail.com" You are logged in as :abc@gmail.com
then i visit this
http://subdomain2.DOMAIN.pk/login.html
it redirects me to login
but i already logged in at http://subdomain1.DOMAIN.pk/index.html
is subdomain affecting the cookies ?
Here is my code:
$this->add('BasicAuth');
$this->auth->setModel('User');
//if site is a user site
if ($this->api->skin != 'default' && !$this->auth->isLoggedIn()) { // && $this->privacy == $this->PRIVATE) {
if(!$this->auth->isPageAllowed($this->page)){
$this->auth->check();
}
echo 'you are visiting: '. $this->api->siteName;
//echo $this->api->siteName;
$m = $this->add('Model_Site');
$tm = $m->loadBy('user_id', $this->auth->get('id'));
$this->mySite = $tm->get('name');
//->ref($this->auth->get('id'));
echo '<br/>';
echo 'your site : '. $this->mySite;
echo '<br/>';
if ($this->siteName == $this->mySite) {
echo 'This is your site';
} else {
echo 'This is not your site';
}
//var_dump($this->auth->get('siteName'));
// var_dump($this->auth->model->ref('theme_id')->get('name'));
//if ($this->auth->get('sitename', skinName))
}
//maindomain
if ($this->api->skin == 'default') {
$this->add('BasicAuth');
$this->auth->allowPage('index');
$this->auth->allowPage('signup');
$this->auth->setModel('User');
if(!$this->auth->isPageAllowed($this->page)){
$this->auth->check();
}
}
I saw some stackoverflow posts related to this topic. I wonder how i can solve it in atk4.
Here are the links:
The best way to tackle this issue in agiletoolkit is by adding this one line in config:
$config['session']['domain'] = '.DOMAIN.pk';