Re: CakePHP Login redirect

2014-07-08 Thread francis declaro
Good point, though you can set the proper redirect in the function login()
in UserController, what is destroyed in logout for Session is Auth. You may
set a separate Session or Cookie for last logged user and check if same
with the current user the redirect Auth->redirect else redirect anywhere
else.


On Sat, Jul 5, 2014 at 10:31 PM, Gagik Navasardyan  wrote:

> Yes I'm sure that the Auth->logout action is being called, and the old
> session is certainly being destroyed too, before the new session is created.
>
> - I tried to rewrite the 'Auth.redirect' property before the Auth->logout
> action call, it have no effect because session is being destroyed.
> - I tried to rewrite that property after the Auth->logout call, of course
> it have no effect either, because as I understand after  the Auth->logout
> call the script terminates (by calling return).
>
> I made a little research and found the following code in  CakePHP>/lib/Cake/Controller/Component/AuthComponent.php (protected
> function _unauthenticated)
>
>
> if ($this->_isLoginAction($controller)) {
> if (empty($controller->request->data)) {
> if (!$this->Session->check('Auth.redirect') &&
> env('HTTP_REFERER')) {
> $this->Session->write('Auth.redirect',
> $controller->referer(null, true));
> }
> }
> return true;
> }
>
> It seems to me that this code is responsible for users login, as we can
> understand from code:
> - if user doesn't have the 'Auth.redirect' property set, means this is a
> new(not logged in) user who needs to login in order to view restricted
> content(for example after search) or user whom session is expired, then
> CakePHP redirects the user on the page on which he was before. And this is
> really a good idea.
>
> But as I understand this is creating my problem, because after the
> Auth->logout action call  Session is being destroyed, means there is no
> 'Auth.redirect' property, so CakePHP setting the 'Auth.redirect' from HTTP
> referer, and as I said this is good if user is coming from any place and
> needs to login(again for example from search), or user session is expired,
> but if user clicks the logout link and logs out he doesn't expect that
> after loging-in again he will return on the page on which he was before, he
> must be redirected not to the HTTP referer page, but the 'loginRedirect'
> page.
>
>
>
> On Tuesday, 1 July 2014 13:14:48 UTC+10, Jeremy Burns wrote:
>
>> Are you certain the Auth->logout action is being called? Is the session
>> clear (destroyed) after logout?
>>
>> On 28 Jun 2014, at 12:54, Gagik Navasardyan  wrote:
>>
>> Hi everyone.
>>
>> I have one question.
>>
>> I'm working on an application which is working in local network and
>> acting as POS(Point of Sale). As you understand it's based on CakePHP
>> framework.
>> Now I'm encountering a strange behaviour, and I don't know is it a bug or
>> not, so I've decided to ask you a question here.
>>
>> - I'm using CakePHP 2.4.2 and the built-in AuthComponent for
>> authentication
>>
>> - *The thing is,* after user logs out and another user logs in (using
>> the same computer and browser), he is being redirected to the page on which
>> the previous user was when logged out. Instead of being redirected to the
>> URL defined in 'loginRedirect'
>>
>> - In this application I'm using role based user permissions system, and
>> the most of time system throwing permission error, because newly logged in
>> user doesn't have permission to view the page on which previous user was
>> when logged out.
>>
>> This behaviour is very strange to me, because as I know the logout
>> function is destroying session, but it seems keeping the last visited URL
>> of the previous user in the 'Auth.redirect' property in the new session.
>> This seems a little bit strange to me, because I'm expecting this kind of
>> redirect in a few cases like:
>> - If user session expired and user have to login again.
>> - user trying to access to a page which is requiring authentication.
>>
>> I analised the code and clearly the problem is in the framework core, and
>> there is no way to rewrite the 'Auth.redirect' property either before or
>> after the 'logout' function call (in any case the session being destroyed
>> and as I understand CakePHP taking and writing the last visited page URL to
>> the new session from HTTP REFERER).
>>
>>
>> So question:
>> Is this a Normal behaviour, and there are some reason why this must be
>> this way, or this is a bug?
>>
>> --
>> 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 unsubscribe from this group and stop receiving emails from it, send an
>> email to cake-php+u...@googlegroups.com.
>> To post to this group, send email to cake...@googlegroups.com.
>>
>> Visit this group at http://groups.g

Re: FormHelper cannot set default meridian when using minute interval and default minute value

2013-03-13 Thread francis declaro
Hi Phantom,
   Finally someone also got stuck on this bug. Actually when you also
set any different date format, it seems the merdian ignore or gets
from a 24hr date format. Can you also submit this bug in CakePHP.
several workaround i did. First either set your field to a 24hr
format, or manually render separate input for Hour, Min and meridian.
for now thats the only i can think of. Hopefully they can fix that or
teach us the right way.


On Wed, Mar 13, 2013 at 12:08 PM, Phantom Watson  wrote:
> I have also asked an updated version of this question on Stack Overflow:
> http://stackoverflow.com/questions/15390026/cakephp-2-2-3-formhelper-cannot-set-default-meridian-when-using-minute-interval
>
>
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Error: Call to a member function find() on a non-object

2012-10-19 Thread francis declaro
change your Controller 

class AddressesController extends AppController {
  public $uses = 'Address'; // or your model name for it
  var_dump($this->Address->find('all', array('limit' => 10)));
 }

-- 
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.