Auth don't work with MAMP ?

2012-11-10 Thread SPH92
Hi,

I use MAMP on mac os lion and cakephp 2.2.3. and i have problem with Auth 
only on local.

I use UsersController like this :

class UsersController extends AppController {
> // on ajoute les vues qui seront autorisées sans mot de passe
> public function beforeFilter() {
> parent::beforeFilter();
> $this->Auth->allow('add', 'logout');
> }
> public function login() {
> if ($this->request->is('post')) {
> $this->Session->read();
> if ($this->Auth->login()) {
> $this->redirect($this->Auth->redirect());
> } else {
> $this->Session->setFlash(__('Invalid username or password, 
> try again'));
> }
> }
> }


If i put $this->Session->read(); then the Session is update, if no there 
are nothing happen.

Can you help me please ?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Auth component doesn't set session variables !

2012-11-10 Thread SPH92
I have the same problem,

and change the order of components, but nothing change.

if i put $this->Session->read(); , it's work but display a message error 
for regenerate_id session

public function login() {
if ($this->request->is('post')) {
//$this->Session->read();
if ($this->Auth->login()) {
$this->redirect($this->Auth->redirect());

Le jeudi 31 mars 2011 21:11:28 UTC+2, damien durant a écrit :
>
> i will try.
>
> In fact it's strange. Because i don't touch anything and it works from my 
> home computers.
> It doesn't from my work, maybe because of proxy setting but it's weird.
>
> On Thu, Mar 31, 2011 at 8:42 PM, cricket 
> > wrote:
>
>> On Thu, Mar 31, 2011 at 10:43 AM, damien d 
>> > 
>> wrote:
>> > Hi,
>> >
>> > I have trouble with the Auth component.
>> >
>> > I try something really simple :
>> >  - I create a user db (with name,password field)
>> >  - I use a appcontroler with this code :
>> >
>> > var $components = array("Session","Auth");
>> >function beforeFilter() {
>> >$this->Auth->fields = array('username' => 'name',
>> > 'password' => 'password');
>> >$this->Auth->loginAction = array('controller' =>
>> > 'users', 'action' => 'login');
>> >$this->Auth->loginRedirect = array('controller' => 
>> 'discs', 'action'
>> > => 'hello');
>> >$this->Auth->logoutRedirect = '/';
>> >$this->Auth->loginError = 'Invalid name / password
>> > combination.  Please try again';
>> >}
>> >
>> >  - I got a classic login.ctp
>> >  - and in my discs_controller :
>> >
>> > function beforeFilter() {
>> >$this->Auth->allow("*");
>> >parent::beforeFilter();
>> >}
>> >
>> >
>> > The issue is, when i log through the login page, i am correctly
>> > redirected, but on the redirect page the Auth variable aren't set.
>> > Here is the content of $session->read() on hello.ctp, after login.
>> > ($session->read('Auth.User') is empty);
>> >
>> > Array ( [Config] => Array ( [userAgent] => [time] => 1301618408
>> > [timeout] => 10 ) )
>> >
>> >
>> > I see there is some trouble with some fix on the net so i :
>> >  - Configure::write('Session.checkAgent', false);
>> >  - Configure::write('Security.level', 'low');
>> > in core.php but without any success.
>>
>> Try putting Auth before Session in the $components array.
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials 
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
>> others with their CakePHP related questions.
>>
>>
>> To unsubscribe from this group, send email to
>> cake-php+u...@googlegroups.com  For more options, visit 
>> this group at http://groups.google.com/group/cake-php
>>
>
>
>
> -- 
> Damien Durant
>  

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.