Thanks for the reply. Here is the login function code. (see below) I
have verified that it is at least getting to this function, and the
Authentication component is finding and returning the user properly.
Yes, I am redirecting at the end of the function.

Is there some trouble then, with having sessions created after coming
from remote server?

        function login()
        {
                if (!empty($this->data))
                {
                        if (!empty($this->data['User']['current_url'])) // for 
remote
logins
                                $this->Session->write('current_url', 
$this->data['User']
['current_url']);

                        $this->Authentication->userFieldName = 'username';
                        $data = 
$this->Authentication->userExists($this->data['User']
['username'], $this->data['User']['password']);

// Just checking here to make sure the user's account is active.
                        if (!empty($data)
                                && $data['Usergroup']['name'] == 'Site Admin' ||
                                        (
                                                
($data['Studio']['StudioStatus']['name'] == 'Active' ||
$data['Studio']['StudioStatus']['name'] == 'Trial')
                                        )
                                )
                        {

                                if (is_null($data['Studio']['expiration_date']) 
||
strtotime($data['Studio']['expiration_date']) > time())
                                {
                                        $expired = false;
                                }
                                else
                                {
                                        if ($data['Usergroup']['name'] == 
'Studio Admin')
                                        {
                                                // Account is expired. Let 
studio admin login just to update
billing info
                                                $expired = true;
                                                
$this->Session->write('expired', true);
                                        }
                                        else // Don't let other users in the 
studio login
                                        {
                                                $this->flash('Sorry, this 
account is not currently active.
Please contact the studio administrator.', 'warning');
                                                $this->redirect('/users/login');
                                                exit();
                                        }

                                }

                                $this->Session->write('User', $data['User']);
                                $this->Session->write('Usergroup', 
$data['Usergroup']);
                                if (isset($data['User']['studio_id']))
                                {
                                        $this->Session->write('Studio', 
$data['Studio']);
                                }
                                else
                                {
                                        $data['Studio']['name'] = 'Studio 
Helper';
                                        $this->Session->write('Studio', 
$data['Studio']);
                                }
                                
$this->Session->write('Usergroup.child_usergroup_id', $this-
>Usergroup->field('id', 'rank < '.$this->Session-
>read('Usergroup.rank').' ORDER BY rank DESC'));

                                $this->flash('Welcome, 
'.$data['User']['first_name'].'!',
'success');

                                // Update last login date
                                $userdata['User']['id'] = $data['User']['id'];
                                $userdata['User']['last_login_date'] = 
date('Y-m-d H:i:s');
                                $this->User->save($userdata);

                                if ($data['Usergroup']['name'] == 'Site Admin')
                                {
                                        if (DEVELOPMENT_MODE)
                                                $this->redirect('/studios');
                                        else
                                        {
                                                // Make SSL
                                                //if (!env("HTTPS"))
                                                $this->redirect('https://' . 
$_SERVER['SERVER_NAME'] .'/
studios');
                                                
//$this->redirect('https://studiohelper.com/studios');
                                        }
                                }
                                else
                                {
                                        // Default initial login page(s)
                                        if (DEVELOPMENT_MODE)
                                                
$this->redirect('/users/dashboard');
                                        else
                                        {
                                                
$this->Follower->logAction($data['Studio']['id'], 'login');
                                                if ($expired == true)
                                                        
$this->redirect('https://' . $_SERVER['SERVER_NAME'] .'/studios/
my_account');
                                                else
                                                        
$this->redirect('https://' . $_SERVER['SERVER_NAME'] .'/users/
dashboard');
                                        }
                                }
                                exit();
                        }
                        else
                        {
                                // Invalid login
                                // Send them back to login form with error
                                $this->flash('Sorry, either that username or 
password combination
doesn\'t exist in the system, or your account is not active. Remember
that usernames and passwords are CaSE sEnsiTIve.', 'warning');
                                $this->redirect('/users/login');
                                exit();
                        }
                }
                else
                {
                        // Display the login form
                        $this->layout = 'login-page';
                        $this->render('login'); //'login' form
                }
        }

Thanks!
Brandon

On Nov 8, 5:05 pm, Rob <[EMAIL PROTECTED]> wrote:
> If I had to guess, I'd say it was because of the way that URL rewrites
> and sessions are handled in CakePHP.
>
> Perhaps if you share a view of the code and where it's failing, it
> might make more sense.
>
> Do you have a redirect at the end of the login function?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to