Re: serious problem with cakephp about CakePHP Auth Component & Permissions

2010-06-15 Thread Jeremy Burns | Class Outfit
Why doesn't the solution you forwarded meet your needs?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com

http://www.classoutfit.com

On 15 Jun 2010, at 18:12, hoss7 wrote:

> hi
> 
> i have serious problem with cakephp about CakePHP Auth Component &
> Permissions
> 
> i am search in the internet and book.cakephp.org and cakeforge.org and
> cakeqs.org
> for find some easy and professional idea(source code) for create
> CakePHP Auth Component - Users, Groups & Permissions but i find noting
> 
> please help me and if you are professional in cakephp send some code
> to my email
> & explain step by step(i am new in cake)
> 
> i want sample code like this:
> http://www.studiocanaria.com/articles/cakephp_auth_component_users_groups_permissions
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> 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 For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


serious problem with cakephp about CakePHP Auth Component & Permissions

2010-06-15 Thread hoss7
hi

i have serious problem with cakephp about CakePHP Auth Component &
Permissions

i am search in the internet and book.cakephp.org and cakeforge.org and
cakeqs.org
for find some easy and professional idea(source code) for create
CakePHP Auth Component - Users, Groups & Permissions but i find noting

please help me and if you are professional in cakephp send some code
to my email
& explain step by step(i am new in cake)

i want sample code like this:
http://www.studiocanaria.com/articles/cakephp_auth_component_users_groups_permissions

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


is Auth component init always the same in the 1.3 version???

2010-06-09 Thread cherif_Gsoul
I have some trouble with the init of Auth component is it the same as
1.2?

it displays me the user login information in the url without loging in
in 1.2 i had not this problem!!!

http://localhost/~cherif/myapp/users/login?_method=POST&data[User][username]=admin&data[User][password]=admin

any one knows the solution for that??? in the cake book nothing is
montioned about that in the migration section.

here is the code snippest for the app_controller:

class AppController extends Controller {
var $components=array('Auth','Session');
var $helpers=array('Session','Form','Html');

function beforeFilter()
{
$this->Auth->allowedActions=array('home','display');
$this->Auth->loginAction = array('controller' => 'users',
'action' => 'login');
$this->Auth->logoutRedirect = array('controller' => 'users',
'action' => 'login');
$this->Auth->loginRedirect = array('controller' => 'contents',
'action' => 'add');
$this->Auth->userScope=array("User.activated"=>1);

}
}

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: problem in auth component when i was creating a login controller.

2010-06-08 Thread Narendra Padala
Thanks sir,
its working fine.!

On Tue, Jun 8, 2010 at 8:40 PM, calvin  wrote:

> Don't post the same question twice, please. You already had people
> helping you with this in the other thread.
>
> On Jun 8, 4:16 am, Narendra Padala  wrote:
> > Hi i am new to cake php, when i am  creating a login authentication using
> > app controller the following error was showed so please help me out. here
> > data base i am using postgress sql, here i dont have permission to
> chanage
> > the databse.
> >
> > this is app_controller.php
> > --
> >
> >  >
> > class AppController extends Controller {
> >
> > var $components = array('Auth', 'RequestHandler');
> >
> > var $uses = array ('Tbluser') ;
> >
> > var $helpers = array('Javascript','Html','Form','Ajax');
> >
> > function beforeFilter(){
> >
> > $this->Auth->loginAction = array('admin' => false, 'controller'
> =>
> > 'tblusers', 'action' => 'login');
> >
> > $this->Auth->authError = "Sorry, you are lacking access.";
> >
> > $this->Auth->loginError = "No, you fool! That's not the right
> > password!";
> >
> > $this->Auth->userModel = 'Tbluser';
> >
> > $this->Auth->authorize = 'tblusers';
> >
> > $this->Auth->fields = array('username' => 'struid', 'password' =>
> > 'strpid');
> >
> > $this->Auth->allow('login');
> >
> > $username = $this->Auth->user('struid');
> >
> > $id = $this->Auth->user('lnguser');
> >
> > $this->set('userId', $this->Auth->user('lnguser'));
> >
> > $this->Auth->loginRedirect = array('controller' => 'tblusers',
> > 'action' => 'index');
> >
> > }
> >
> > function isAuthorized() {
> > return true;
> > }
> >
> > }
> >
> > ?>
> >
> > Error Message :
> > 
> >
> > *Warning* (512) : Auth::isAuthorized() -
> > $authorize is set to an incorrect value.  Allowed settings are:
> > "actions", "crud", "model" or null.
> > [*CORE/cake/libs/controller/components/auth.php*, line *525*]
> > *Warning* (2) : Cannot modify header information
> > - headers already sent by (output started at
> > /var/www/wizard_auth/cake/basics.php:108)
> > [*CORE/cake/libs/controller/controller.php*, line *646*]
> >
> > Please any one can help me out...thanks in advance..!
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: problem in auth component when i was creating a login controller.

2010-06-08 Thread calvin
Don't post the same question twice, please. You already had people
helping you with this in the other thread.

On Jun 8, 4:16 am, Narendra Padala  wrote:
> Hi i am new to cake php, when i am  creating a login authentication using
> app controller the following error was showed so please help me out. here
> data base i am using postgress sql, here i dont have permission to chanage
> the databse.
>
> this is app_controller.php
> --
>
> 
> class AppController extends Controller {
>
>     var $components = array('Auth', 'RequestHandler');
>
>     var $uses = array ('Tbluser') ;
>
>     var $helpers = array('Javascript','Html','Form','Ajax');
>
>     function beforeFilter(){
>
>         $this->Auth->loginAction = array('admin' => false, 'controller' =>
> 'tblusers', 'action' => 'login');
>
>         $this->Auth->authError = "Sorry, you are lacking access.";
>
>         $this->Auth->loginError = "No, you fool! That's not the right
> password!";
>
>         $this->Auth->userModel = 'Tbluser';
>
>         $this->Auth->authorize = 'tblusers';
>
>         $this->Auth->fields = array('username' => 'struid', 'password' =>
> 'strpid');
>
>         $this->Auth->allow('login');
>
>         $username = $this->Auth->user('struid');
>
>         $id = $this->Auth->user('lnguser');
>
>         $this->set('userId', $this->Auth->user('lnguser'));
>
>         $this->Auth->loginRedirect = array('controller' => 'tblusers',
> 'action' => 'index');
>
>     }
>
>     function isAuthorized() {
>             return true;
>     }
>
> }
>
> ?>
>
> Error Message :
> 
>
> *Warning* (512) : Auth::isAuthorized() -
> $authorize is set to an incorrect value.  Allowed settings are:
> "actions", "crud", "model" or null.
> [*CORE/cake/libs/controller/components/auth.php*, line *525*]
> *Warning* (2) : Cannot modify header information
> - headers already sent by (output started at
> /var/www/wizard_auth/cake/basics.php:108)
> [*CORE/cake/libs/controller/controller.php*, line *646*]
>
> Please any one can help me out...thanks in advance..!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: problem in auth component when i was creating a login controller.

2010-06-08 Thread Jeremy Burns
Read the error message and obey:

You have:  $this->Auth->authorize = 'tblusers';

The error says:

> Warning (512): Auth::isAuthorized() - $authorize is set to an incorrect 
> value.  Allowed settings are: "actions", "crud", "model" or null. 
> [CORE/cake/libs/controller/components/auth.php, line 525]


Jeremy Burns
jeremybu...@me.com


On 8 Jun 2010, at 12:16, Narendra Padala wrote:

> Hi i am new to cake php, when i am  creating a login authentication using app 
> controller the following error was showed so please help me out. here data 
> base i am using postgress sql, here i dont have permission to chanage the 
> databse.
> 
> 
> this is app_controller.php
> --
> 
>  
> class AppController extends Controller {
> 
> var $components = array('Auth', 'RequestHandler');
> 
> var $uses = array ('Tbluser') ; 
> 
> var $helpers = array('Javascript','Html','Form','Ajax');
> 
> function beforeFilter(){
> 
> $this->Auth->loginAction = array('admin' => false, 'controller' => 
> 'tblusers', 'action' => 'login');
> 
> $this->Auth->authError = "Sorry, you are lacking access.";
> 
> $this->Auth->loginError = "No, you fool! That's not the right 
> password!";
> 
> $this->Auth->userModel = 'Tbluser';
> 
> $this->Auth->authorize = 'tblusers';
> 
> $this->Auth->fields = array('username' => 'struid', 'password' => 
> 'strpid');
> 
> $this->Auth->allow('login');
> 
> $username = $this->Auth->user('struid');
> 
> $id = $this->Auth->user('lnguser');
> 
> $this->set('userId', $this->Auth->user('lnguser'));
> 
> $this->Auth->loginRedirect = array('controller' => 'tblusers', 
> 'action' => 'index');
> 
> }
> 
> function isAuthorized() {
> return true;
> }
> 
> }
> ?>
> 
> 
> Error Message :
> 
> 
> Warning (512): Auth::isAuthorized() - $authorize is set to an incorrect 
> value.  Allowed settings are: "actions", "crud", "model" or null. 
> [CORE/cake/libs/controller/components/auth.php, line 525]
> 
> Warning (2): Cannot modify header information - headers already sent by 
> (output started at /var/www/wizard_auth/cake/basics.php:108) 
> [CORE/cake/libs/controller/controller.php, line 646]
> 
> 
> 
> Please any one can help me out...thanks in advance..!
> 
> 
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>  
> 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 For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


problem in auth component when i was creating a login controller.

2010-06-08 Thread Narendra Padala
Hi i am new to cake php, when i am  creating a login authentication using
app controller the following error was showed so please help me out. here
data base i am using postgress sql, here i dont have permission to chanage
the databse.


this is app_controller.php
--

Auth->loginAction = array('admin' => false, 'controller' =>
'tblusers', 'action' => 'login');

$this->Auth->authError = "Sorry, you are lacking access.";

$this->Auth->loginError = "No, you fool! That's not the right
password!";

$this->Auth->userModel = 'Tbluser';

$this->Auth->authorize = 'tblusers';

$this->Auth->fields = array('username' => 'struid', 'password' =>
'strpid');

$this->Auth->allow('login');

$username = $this->Auth->user('struid');

$id = $this->Auth->user('lnguser');

$this->set('userId', $this->Auth->user('lnguser'));

$this->Auth->loginRedirect = array('controller' => 'tblusers',
'action' => 'index');

}

function isAuthorized() {
return true;
}

}
?>


Error Message :


*Warning* (512) : Auth::isAuthorized() -
$authorize is set to an incorrect value.  Allowed settings are:
"actions", "crud", "model" or null.
[*CORE/cake/libs/controller/components/auth.php*, line *525*]
*Warning* (2) : Cannot modify header information
- headers already sent by (output started at
/var/www/wizard_auth/cake/basics.php:108)
[*CORE/cake/libs/controller/controller.php*, line *646*]


Please any one can help me out...thanks in advance..!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Stop Auth component from redirecting

2010-06-07 Thread Ed Propsner
If I'm following you correctly you could use $this->Auth->autoRedirect =
false;

On Mon, Jun 7, 2010 at 4:11 PM, junker37  wrote:

> How can I stop the auth component from redirecting?  Currently, when I
> make an ajax call, and the user isn't allowed to the requested action,
> cake redirects to the index of the requested controller.  I want to
> know how I can stop it from redirecting so I can pop up an error
> message.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Stop Auth component from redirecting

2010-06-07 Thread junker37
How can I stop the auth component from redirecting?  Currently, when I
make an ajax call, and the user isn't allowed to the requested action,
cake redirects to the index of the requested controller.  I want to
know how I can stop it from redirecting so I can pop up an error
message.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Auth Component and user information.

2010-06-07 Thread cricket
On Jun 7, 2:33 pm, saidbakr  wrote:
> I also noticed another thing:
>
> The output of $this->Auth->user() ,without key parameter, is an array
> which is listing User model only without regarding the associated
> model.

Look at the API:

http://api.cakephp.org/class/auth-component#method-AuthComponentuser

Parameters:
$keystring  field to retrive. Leave null to get entire User
record  optionalNULL

if ($key == null) {
  $model =& $this->getModel();
  return array($model->alias => $this->Session->read($this-
>sessionKey));
} else {

And, of course, $this->sessionKey cannot be some arbitrary string that
the component doesn't know about. It can't read your mind so it
defaults to what it knows. Namely, 'Auth.User'.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Auth Component and user information.

2010-06-07 Thread cricket
On Jun 7, 2:19 pm, saidbakr  wrote:
> Well, but what about the data in the associated Model Rules? How could
> I get it?

The AuthComponent does not require anything in the User::login()
method. However, if you wish to run some code upon login, you
implement it there.

public function login()
{
if ($user = $this->Auth->user())
{
/* fetch and store your associated data
 */
$this->Session->write(
'Auth.User.whatever',
$this->User->find(...)
);

$this->redirect($this->Auth->loginRedirect);
}
}

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Auth Component and user information.

2010-06-07 Thread Jeremy Burns
I think the point is that as part of your log in process you scrape information 
from your associated model and add it to the User array. You could also do an 
update if the associated model data was changed, I guess.

Jeremy Burns
jeremybu...@me.com


On 7 Jun 2010, at 19:33, saidbakr wrote:

> I also noticed another thing:
> 
> The output of $this->Auth->user() ,without key parameter, is an array
> which is listing User model only without regarding the associated
> model.
> 
> 
> Array ( [User] => Array ( [id] => 1 [username] => admin [name] => Said
> Bakr [join_date] => 2010-06-14 19:35:00 [email] => said@gmail.com
> [rule_id] => 1 ) )
> 
> On Jun 7, 8:27 pm, cricket  wrote:
>> On Jun 7, 11:39 am, saidbakr  wrote:
>> 
>> 
>> 
>>> Hi,
>> 
>>> I use User model to handle user's basic data such as Name, username,
>>> password and so on.
>> 
>>> The User model is associated with Rule model by belongsTo association,
>>> while Rule model is associated to User model by hasMany association.
>> 
>>> The later model "Rule" is meant by something like users groups so it
>>> handles name, description, value and of-course id, for example, two
>>> records from rules table:
>> 
>>> id -> 1
>>> name -> Administrators
>>> description -> The super users group!
>>> value -> ABC
>> 
>>> id -> 2
>>> name -> Editors
>>> decription -> reviewers and articles writers.
>>> value -> BC
>> 
>>> In AuthComponent documentation 
>>> :http://book.cakephp.org/view/247/AuthComponent-Methods#user-387
>> 
>>> when they talked about "user" method of the component, they regards
>>> that it is possible to retrieve the current user data from the session
>>> in the view like:
>> 
>>> # $session->read('Auth.User.first_name') //returns particular field
>>> value
>> 
>>> This example shows that the access of User model property first_name.
>> 
>>> My Question Is,
>> 
>>> How could I able to access the associated model property "Rule" such
>>> as Rule.name ?
>> 
>>> Best Regards!
>> 
>> You should implement a login() method in your UsersController. In
>> there, do something like:
>> 
>> $this->Session->write('Auth.User.foo', 'bar');
>> 
>> When you need to read the info:
>> 
>> echo $this->Auth->user('foo');
>> 
>> Basically, Auth::user() simply reads whatever data has been written to
>> the Session's 'Auth.User' key (note the uppercase U). You can also
>> write entire arrays:
>> 
>> $this->Session->write('Auth.User.extra', array('foo' => 'bar'));
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> 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 For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Auth Component and user information.

2010-06-07 Thread saidbakr
I also noticed another thing:

The output of $this->Auth->user() ,without key parameter, is an array
which is listing User model only without regarding the associated
model.


Array ( [User] => Array ( [id] => 1 [username] => admin [name] => Said
Bakr [join_date] => 2010-06-14 19:35:00 [email] => said@gmail.com
[rule_id] => 1 ) )

On Jun 7, 8:27 pm, cricket  wrote:
> On Jun 7, 11:39 am, saidbakr  wrote:
>
>
>
> > Hi,
>
> > I use User model to handle user's basic data such as Name, username,
> > password and so on.
>
> > The User model is associated with Rule model by belongsTo association,
> > while Rule model is associated to User model by hasMany association.
>
> > The later model "Rule" is meant by something like users groups so it
> > handles name, description, value and of-course id, for example, two
> > records from rules table:
>
> > id -> 1
> > name -> Administrators
> > description -> The super users group!
> > value -> ABC
>
> > id -> 2
> > name -> Editors
> > decription -> reviewers and articles writers.
> > value -> BC
>
> > In AuthComponent documentation 
> > :http://book.cakephp.org/view/247/AuthComponent-Methods#user-387
>
> > when they talked about "user" method of the component, they regards
> > that it is possible to retrieve the current user data from the session
> > in the view like:
>
> > # $session->read('Auth.User.first_name') //returns particular field
> > value
>
> > This example shows that the access of User model property first_name.
>
> > My Question Is,
>
> > How could I able to access the associated model property "Rule" such
> > as Rule.name ?
>
> > Best Regards!
>
> You should implement a login() method in your UsersController. In
> there, do something like:
>
> $this->Session->write('Auth.User.foo', 'bar');
>
> When you need to read the info:
>
> echo $this->Auth->user('foo');
>
> Basically, Auth::user() simply reads whatever data has been written to
> the Session's 'Auth.User' key (note the uppercase U). You can also
> write entire arrays:
>
> $this->Session->write('Auth.User.extra', array('foo' => 'bar'));

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Auth Component and user information.

2010-06-07 Thread saidbakr
Well, but what about the data in the associated Model Rules? How could
I get it?

On Jun 7, 8:27 pm, cricket  wrote:
> On Jun 7, 11:39 am, saidbakr  wrote:
>
>
>
> > Hi,
>
> > I use User model to handle user's basic data such as Name, username,
> > password and so on.
>
> > The User model is associated with Rule model by belongsTo association,
> > while Rule model is associated to User model by hasMany association.
>
> > The later model "Rule" is meant by something like users groups so it
> > handles name, description, value and of-course id, for example, two
> > records from rules table:
>
> > id -> 1
> > name -> Administrators
> > description -> The super users group!
> > value -> ABC
>
> > id -> 2
> > name -> Editors
> > decription -> reviewers and articles writers.
> > value -> BC
>
> > In AuthComponent documentation 
> > :http://book.cakephp.org/view/247/AuthComponent-Methods#user-387
>
> > when they talked about "user" method of the component, they regards
> > that it is possible to retrieve the current user data from the session
> > in the view like:
>
> > # $session->read('Auth.User.first_name') //returns particular field
> > value
>
> > This example shows that the access of User model property first_name.
>
> > My Question Is,
>
> > How could I able to access the associated model property "Rule" such
> > as Rule.name ?
>
> > Best Regards!
>
> You should implement a login() method in your UsersController. In
> there, do something like:
>
> $this->Session->write('Auth.User.foo', 'bar');
>
> When you need to read the info:
>
> echo $this->Auth->user('foo');
>
> Basically, Auth::user() simply reads whatever data has been written to
> the Session's 'Auth.User' key (note the uppercase U). You can also
> write entire arrays:
>
> $this->Session->write('Auth.User.extra', array('foo' => 'bar'));

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Auth Component and user information.

2010-06-07 Thread cricket
On Jun 7, 11:39 am, saidbakr  wrote:
> Hi,
>
> I use User model to handle user's basic data such as Name, username,
> password and so on.
>
> The User model is associated with Rule model by belongsTo association,
> while Rule model is associated to User model by hasMany association.
>
> The later model "Rule" is meant by something like users groups so it
> handles name, description, value and of-course id, for example, two
> records from rules table:
>
> id -> 1
> name -> Administrators
> description -> The super users group!
> value -> ABC
>
> id -> 2
> name -> Editors
> decription -> reviewers and articles writers.
> value -> BC
>
> In AuthComponent documentation 
> :http://book.cakephp.org/view/247/AuthComponent-Methods#user-387
>
> when they talked about "user" method of the component, they regards
> that it is possible to retrieve the current user data from the session
> in the view like:
>
> # $session->read('Auth.User.first_name') //returns particular field
> value
>
> This example shows that the access of User model property first_name.
>
> My Question Is,
>
> How could I able to access the associated model property "Rule" such
> as Rule.name ?
>
> Best Regards!

You should implement a login() method in your UsersController. In
there, do something like:

$this->Session->write('Auth.User.foo', 'bar');

When you need to read the info:

echo $this->Auth->user('foo');

Basically, Auth::user() simply reads whatever data has been written to
the Session's 'Auth.User' key (note the uppercase U). You can also
write entire arrays:

$this->Session->write('Auth.User.extra', array('foo' => 'bar'));

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Auth Component and user information.

2010-06-07 Thread saidbakr
Hi,

I use User model to handle user's basic data such as Name, username,
password and so on.

The User model is associated with Rule model by belongsTo association,
while Rule model is associated to User model by hasMany association.

The later model "Rule" is meant by something like users groups so it
handles name, description, value and of-course id, for example, two
records from rules table:

id -> 1
name -> Administrators
description -> The super users group!
value -> ABC

id -> 2
name -> Editors
decription -> reviewers and articles writers.
value -> BC

In AuthComponent documentation :
http://book.cakephp.org/view/247/AuthComponent-Methods#user-387

when they talked about "user" method of the component, they regards
that it is possible to retrieve the current user data from the session
in the view like:

# $session->read('Auth.User.first_name') //returns particular field
value

This example shows that the access of User model property first_name.

My Question Is,

How could I able to access the associated model property "Rule" such
as Rule.name ?

Best Regards!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: XMLHttpRequest bypassing Auth component

2010-05-27 Thread Miles J
Ive ran into the complete opposite. My ajax requests would always be
redirected to the login page.

Can we see your code? Are you allowing the actions on accident?

On May 26, 4:43 pm, heratech  wrote:
> this has been posted before by someone else but there was no 
> answerhttp://groups.google.com/group/cake-php/browse_thread/thread/9b15f303...
>
> basically the auth component works fine if i browse to the json page
> using my browser but if it uses the xmlhttprequest post it doesnt seem
> to be a requirement that i am logged in?
> is this the correct behaviour. how do i change it?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


XMLHttpRequest bypassing Auth component

2010-05-26 Thread heratech
this has been posted before by someone else but there was no answer
http://groups.google.com/group/cake-php/browse_thread/thread/9b15f3038a95cd30/a80797d08a1b5517?lnk=gst&q=auth&pli=1

basically the auth component works fine if i browse to the json page
using my browser but if it uses the xmlhttprequest post it doesnt seem
to be a requirement that i am logged in?
is this the correct behaviour. how do i change it?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Updating user values in Auth component

2010-05-01 Thread WhyNotSmile
Thanks to both of you.  That's helpful.



On 28 Apr, 20:08, Miles J  wrote:
> I prefer this method:
>
> http://www.milesj.me/blog/read/31/Refreshing-The-Auths-Session
>
> On Apr 28, 9:22 am, John Andersen  wrote:
>
>
>
> > Without changing anything in the Auth component, I do think that you
> > could redo the login of the current user, when you have updated the
> > users information - for example:
>
> > [code]
> > $this->Auth->login( $this->Auth->user() );
> > [/code]
>
> > That should update the user information in the Auth session key.
> > I haven't tested it, but give it a try :)
> > Enjoy,
> >    John
>
> > Ps. the only issue I could see, is that the password may not be
> > available!
>
> > On Apr 28, 5:16 pm, WhyNotSmile 
> > wrote:
>
> > > I'm using the built-in Auth component with CakePHP.  In part of my
> > > site, I allow my user to update their details (e.g. email address).
> > > When I then retrieve the user information from the Auth component
> > > (using $this->Auth->user()), the details are still the old ones.
>
> > > Is there a way to update the values in the Auth component?  I know
> > > that the fact I have a problem with this indicates that I'm probably
> > > doing it wrong, so I'm going to change the way it's finding the data,
> > > but I'm just curious as to whether the Auth values can be changed.
>
> > > Thanks
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > with their CakePHP related questions.
>
> > > 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 For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: CakePHP Auth Component - Users, Groups & Permissions

2010-04-30 Thread hoss7
i dont see no errors, i want change this code for work with cakephp 1.3

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: CakePHP Auth Component - Users, Groups & Permissions

2010-04-30 Thread hoss7
i have this app_controller code in cakephp 1.2:


params['admin'])) {
// Set the default layout
$this->layout = 'admin';
}else {
$this->layout = 'default';
}
    //Override default fields used by Auth component
$this->Auth->fields =
array('username'=>'email_address','password'=>'password');
//Set application wide actions which do not require
authentication
$this->Auth-
>allow(array('display','view','admin_login','index','pindex'));//
IMPORTANT for CakePHP 1.2 final release change this to $this->Auth-
>allow(array('display'));
//Set the default redirect for users who logout
$this->Auth->logoutRedirect = '/';
   //Set the default redirect for users who login
$this->Auth->loginRedirect = '/admin/images/index';
//Extend auth component to include authorisation via
isAuthorized action
    $this->Auth->authorize = 'controller';
//Restrict access to only users with an active account
$this->Auth->userScope = array('User.active = 1');
//Pass auth component data over to view files
$this->set('Auth',$this->Auth->user());
}

/**
 * beforeRender
 *
 * Application hook which runs after each action but, before the
view file is
 * rendered
 *
 * @access public
 */
function beforeRender(){
//If we have an authorised user logged then pass over an array
of controllers
//to which they have index action permission
if($this->Auth->user()){
$controllerList = Configure::listObjects('controller');
$permittedControllers = array();
foreach($controllerList as $controllerItem){
if($controllerItem <> 'App'){
if($this->__permitted($controllerItem,'index')){
$permittedControllers[] = $controllerItem;
}
}
}
}
$this->set(compact('permittedControllers'));
}
/**
 * isAuthorized
 *
 * Called by Auth component for establishing whether the current
authenticated
 * user has authorization to access the current controller:action
 *
 * @return true if authorised/false if not authorized
 * @access public
 */
function isAuthorized(){
return $this->__permitted($this->name,$this->action);
}
/**
 * __permitted
 *
 * Helper function returns true if the currently authenticated
user has permission
 * to access the controller:action specified by $controllerName:
$actionName
 * @return
 * @param $controllerName Object
 * @param $actionName Object
 */
function __permitted($controllerName,$actionName){
//Ensure checks are all made lower case
$controllerName = low($controllerName);
   $actionName = low($actionName);
//If permissions have not been cached to session...
if(!$this->Session->check('Permissions')){
//...then build permissions array and cache it
  $permissions = array();
//everyone gets permission to logout
$permissions[]='users:logout';
//Import the User Model so we can build up the permission
cache
App::import('Model', 'User');
$thisUser = new User;
//Now bring in the current users full record along with
groups
   $thisGroups = $thisUser->find(array('User.id'=>$this->Auth-
>user('id')));
$thisGroups = $thisGroups['Group'];
foreach($thisGroups as $thisGroup){
   $thisPermissions = $thisUser->Group-
>find(array('Group.id'=>$thisGroup['id']));
$thisPermissions = $thisPermissions['Permission'];
foreach($thisPermissions as $thisPermission){
$permissions[]=$thisPermission['name'];
}
}
   //write the permissions array to session
$this->Session->write('Permissions',$permissions);
   }else{
//...they have been cached already, so retrieve them
$permissions = $this->Session->read('Permissions');
var_dump($permissions);

}
//Now iterate through permissions for a positive match
foreach($permissions as $permission){
if($permission == '*'){
return true;//Super Admin Bypass Found
}
if($permission == $controllerName.':*'){

Re: CakePHP Auth Component - Users, Groups & Permissions

2010-04-29 Thread Jeremy Burns
What's wrong with the code there - does it break in 1.3? If so, where? For 
instance, I can see a '$this->Session->del' which will need to be changed to 
'$this->Session->delete'. What errors are you getting?

Jeremy Burns
jeremybu...@me.com


On 30 Apr 2010, at 06:45, hoss7 wrote:

> i want Auth Component - Users, Groups & Permissions for cakephp 1.3
> like this code for cakephp 1.2:
> 
> http://www.studiocanaria.com/articles/cakephp_auth_component_users_groups_permissions_revisited
> 
> i need powerful code.
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> 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 For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


CakePHP Auth Component - Users, Groups & Permissions

2010-04-29 Thread hoss7
 i want Auth Component - Users, Groups & Permissions for cakephp 1.3
like this code for cakephp 1.2:

http://www.studiocanaria.com/articles/cakephp_auth_component_users_groups_permissions_revisited

 i need powerful code.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Updating user values in Auth component

2010-04-28 Thread Miles J
I prefer this method:

http://www.milesj.me/blog/read/31/Refreshing-The-Auths-Session

On Apr 28, 9:22 am, John Andersen  wrote:
> Without changing anything in the Auth component, I do think that you
> could redo the login of the current user, when you have updated the
> users information - for example:
>
> [code]
> $this->Auth->login( $this->Auth->user() );
> [/code]
>
> That should update the user information in the Auth session key.
> I haven't tested it, but give it a try :)
> Enjoy,
>    John
>
> Ps. the only issue I could see, is that the password may not be
> available!
>
> On Apr 28, 5:16 pm, WhyNotSmile 
> wrote:
>
>
>
> > I'm using the built-in Auth component with CakePHP.  In part of my
> > site, I allow my user to update their details (e.g. email address).
> > When I then retrieve the user information from the Auth component
> > (using $this->Auth->user()), the details are still the old ones.
>
> > Is there a way to update the values in the Auth component?  I know
> > that the fact I have a problem with this indicates that I'm probably
> > doing it wrong, so I'm going to change the way it's finding the data,
> > but I'm just curious as to whether the Auth values can be changed.
>
> > Thanks
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Updating user values in Auth component

2010-04-28 Thread John Andersen
Without changing anything in the Auth component, I do think that you
could redo the login of the current user, when you have updated the
users information - for example:

[code]
$this->Auth->login( $this->Auth->user() );
[/code]

That should update the user information in the Auth session key.
I haven't tested it, but give it a try :)
Enjoy,
   John

Ps. the only issue I could see, is that the password may not be
available!

On Apr 28, 5:16 pm, WhyNotSmile 
wrote:
> I'm using the built-in Auth component with CakePHP.  In part of my
> site, I allow my user to update their details (e.g. email address).
> When I then retrieve the user information from the Auth component
> (using $this->Auth->user()), the details are still the old ones.
>
> Is there a way to update the values in the Auth component?  I know
> that the fact I have a problem with this indicates that I'm probably
> doing it wrong, so I'm going to change the way it's finding the data,
> but I'm just curious as to whether the Auth values can be changed.
>
> Thanks
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Updating user values in Auth component

2010-04-28 Thread WhyNotSmile
I'm using the built-in Auth component with CakePHP.  In part of my
site, I allow my user to update their details (e.g. email address).
When I then retrieve the user information from the Auth component
(using $this->Auth->user()), the details are still the old ones.

Is there a way to update the values in the Auth component?  I know
that the fact I have a problem with this indicates that I'm probably
doing it wrong, so I'm going to change the way it's finding the data,
but I'm just curious as to whether the Auth values can be changed.

Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Joining Data for Auth Component to read

2010-04-22 Thread cricket
See if this works.

AppController:

function beforeFilter()
{
parent::beforeFilter();

$this->Auth->fields = array(
...
);
$this->Auth->loginAction = array(
...
);

/* set the redirect for post-login
 */
$this->Auth->loginRedirect = array(
...
);

/* but tell Auth not to redirect automatically
 */
$this->Auth->autoRedirect = false;
}


public function login()
{
if ($user = $this->Auth->user())
{
if (empty($this->data))
{
$this->redirect($this->Auth->loginRedirect);
}

$this->User->Group->recursive = -1;

$this->Session->write(
'Group',
$this->User->Group->read(
null,
$this->Auth->user('group_id')
)
);

$this->redirect($this->Auth->loginRedirect);
}
}

On Apr 22, 12:47 am, capo64  wrote:
> Well basically I have over a thousand products and I'll be assigning a
> price modifier per group (ie Bronze Silver and Gold members have
> different prices for their items), so I would think the best way would
> be to check the User's Group's price_modifier when the user logs in,
> and store it in the session. Then on each of the product pages
> multiply the product price by the modifier.
>
> I just can't seem to figure out how to implement the code. I tried in
> the user controller:
>
>                 function login() {
>                         if ($this->Auth->user('id'))
>                                 $session->write('Auth.User.Group', 
> $this->User->Group->findById($this->Auth->user('group_id')));
>
>                 }
>
> But I don't think I fully understand how the login function works.
> Please let me know if this is wrong in many ways. I'm brand new to
> CakePHP :\
>
> I have an association that User belongsTo Group. There's no way to get
> Auth to use this association?
> On Apr 21, 1:19 am, thatsgreat2345  wrote:
>
>
>
> > Auth component only stores values that are in the users table, so you
> > can grab the user id using $this->Auth->user('id') and then do a find.
> > Or alternatively you can use $this->Auth->login and once if it
> > successfully logs in then do a find on the group data and store it in
> > the session for later use especially if you are going to be accessing
> > it a lot. But if you only need it in one place I'd just recommend
> > doing the find when it is needed.
>
> > On Apr 20, 5:52 pm, capo64  wrote:
>
> > > Hi I have a setup with Users and Groups.
>
> > > I've been reading user data using this in my views:
> > > $session->read('Auth.User.full_name'); ..etc
>
> > > Now I need to access information about the group of the user. How can
> > > I go about doing this?
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > with their CakePHP related questions.
>
> > > 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 For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Joining Data for Auth Component to read

2010-04-21 Thread WebbedIT
In my app_controller I have the following

function beforeFilter() {
  ...
  if ($this->Auth->user()) {
$this->__authExtra();
App::import('Model', 'User');
User::store($this->Session->read('Auth'));
  } else {
$this->Session->del('Auth.Person');
  }
  ...
}

// The App::import ad User::store lines are linked to
http://www.pseudocoder.com/archives/2008/10/06/accessing-user-sessions-from-models-or-anywhere-in-cakephp-revealed/

function __authExtra() {
  $auth = $this->Session->read('Auth');
  $data = ClassRegistry::init('User')->find('first', array(
'conditions' => array('User.id'=>$auth['User']['id']),
'contain' => array('Person'=>array('PrimaryEmail.address',
'Organisation'=>array('PrimaryEmail.address')))
  ));
  $this->Session->write('Auth', Set::merge($auth, $data));
}

I have recently installed memcache and I'm beginning to work with
caching my datasets to save on queries, so my real __authExtra() looks
like

function __authExtra() {
  $auth = $this->Session->read('Auth');
  $cKey = 'data:sessionAuth:' . $auth['User']['id'];
  if(!$data = Cache::read($cKey, 'default')) {
$data = ClassRegistry::init('User')->find('first', array(
  'conditions' => array('User.id'=>$auth['User']['id']),
  'contain' => array('Person'=>array('PrimaryEmail.address',
'Organisation'=>array('PrimaryEmail.address')))
));
Cache::write($cKey, $data, 'default');
  }
  $this->Session->write('Auth', Set::merge($auth, $data));
}

Hope this felps

Paul

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Joining Data for Auth Component to read

2010-04-21 Thread capo64
Well basically I have over a thousand products and I'll be assigning a
price modifier per group (ie Bronze Silver and Gold members have
different prices for their items), so I would think the best way would
be to check the User's Group's price_modifier when the user logs in,
and store it in the session. Then on each of the product pages
multiply the product price by the modifier.

I just can't seem to figure out how to implement the code. I tried in
the user controller:

function login() {
if ($this->Auth->user('id'))
$session->write('Auth.User.Group', 
$this->User->Group-
>findById($this->Auth->user('group_id')));
}

But I don't think I fully understand how the login function works.
Please let me know if this is wrong in many ways. I'm brand new to
CakePHP :\

I have an association that User belongsTo Group. There's no way to get
Auth to use this association?
On Apr 21, 1:19 am, thatsgreat2345  wrote:
> Auth component only stores values that are in the users table, so you
> can grab the user id using $this->Auth->user('id') and then do a find.
> Or alternatively you can use $this->Auth->login and once if it
> successfully logs in then do a find on the group data and store it in
> the session for later use especially if you are going to be accessing
> it a lot. But if you only need it in one place I'd just recommend
> doing the find when it is needed.
>
> On Apr 20, 5:52 pm, capo64  wrote:
>
> > Hi I have a setup with Users and Groups.
>
> > I've been reading user data using this in my views:
> > $session->read('Auth.User.full_name'); ..etc
>
> > Now I need to access information about the group of the user. How can
> > I go about doing this?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: CakePHP Auth Component cannot remember url before authentication

2010-04-21 Thread Prof. No Time
I got it dear. Thanks very much. I opened up the Auth component and
digested it myself (Afterall, its just another component written by a
brother of mine, lol).

I then discovered that the session variable for storing the intended
url is 'Auth.redirect', so I leveraged on it by checking it and
redirecting there if it exists, otherwise, I redirect to my own
default user role page. Its working like breeze!

THANK YOU.

On Apr 19, 12:01 pm, cricket  wrote:
> On Apr 19, 6:19 am, "Prof. No Time" 
> wrote:
>
> > Thanks for the response Cricket, I have dumped my codes below. Please
> > assist me. Regards.
>
> > My AppController::beforeFilter()
>
> > function beforeFilter(){
> >   $this->Auth->fields = array('username' => 'username', 'password' =>
> > 'passkey');
> >   $this->Auth->allow($this->allowedActions);
>
> The above line is unnecessary.
>
> >   $this->Auth->authorize = 'controller';
> >   $this->Auth->loginAction = array('controller' => 'users', 'action'
> > => 'login');
> >   $this->Auth->loginRedirect = array('controller' => 'pages', 'action'
> > => 'display', 'home');
> >   $this->Auth->logoutRedirect = '/';
> >   $this->Auth->autoRedirect = false;
>
> The above line tellsAuthnot to call its own redirect() method, even
> though the redirect var is set.
>
>
>
> > }
>
> > My UsersController::login()
>
> > if ($this->Auth->user()) {
> >     if (!empty($this->data)) {
> >       $this->Session->setFlash('You have been logged in
> > successfully');
> >       $this->_postLoginOperations(); //This method redirects the user
> > based on role
> >       $this->data = array();
> >     }
> >     $this->redirect($this->Auth->redirect());
>
> This is maybe a problem. You're instructingAuthto redirect if
> there's no submitted data. IOW, the first time the login view is
> displayed. That's what it looks like, anyway.
>
> But I can't say more without knowing what _postLoginOperations() does.
>
> When you say it doesn't work, do you mean thatAuthis sending you
> somewhere other than pages->display->home? Or that you're seeing an
> endless loop? Something else?
>
> Believe me--I know thatAuthcan be pretty darned confusing.
>
> Check out the newCakePHPQuestions sitehttp://cakeqs.organd help others with 
> theirCakePHPrelated questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Joining Data for Auth Component to read

2010-04-20 Thread thatsgreat2345
Auth component only stores values that are in the users table, so you
can grab the user id using $this->Auth->user('id') and then do a find.
Or alternatively you can use $this->Auth->login and once if it
successfully logs in then do a find on the group data and store it in
the session for later use especially if you are going to be accessing
it a lot. But if you only need it in one place I'd just recommend
doing the find when it is needed.

On Apr 20, 5:52 pm, capo64  wrote:
> Hi I have a setup with Users and Groups.
>
> I've been reading user data using this in my views:
> $session->read('Auth.User.full_name'); ..etc
>
> Now I need to access information about the group of the user. How can
> I go about doing this?
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Joining Data for Auth Component to read

2010-04-20 Thread capo64
Hi I have a setup with Users and Groups.

I've been reading user data using this in my views:
$session->read('Auth.User.full_name'); ..etc

Now I need to access information about the group of the user. How can
I go about doing this?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Problem with Auth Component hashes

2010-04-20 Thread Stefano Martins
Duh, I forgot about the salt value and added the user in the users
table without it.

Thanks, people!

On 19 abr, 04:50, WebbedIT  wrote:
> If wanting to compare your hashed password with a salt inflected
> hashed string use
>
> if ($password == $this->Auth->password($password_confirm))
>
> or
>
> if ($password == Security::hash(Configure::read('Security.salt') .
> $password_confirm)
>
> HTH
>
> Paul
>
> On Apr 18, 5:24 pm, Zaky Katalan-Ezra  wrote:
>
>
>
> >  I think the Auth uses a salt.
>
> > On Sun, Apr 18, 2010 at 6:43 PM,StefanoMartins wrote:
>
> > > Hello folks,
>
> > > As I was studying CakePHP and the Auth Component, I've found out that
> > > it's not using sha1 hashes - or at least it doesn't seems to - by
> > > default. I had to manually set it to use md5 hashes, following the
> > > instructions given by the Cookbook. For the string "stefano", Cake's
> > > generating the "35b914b05db99937e255f0eaebd3ac89f804a1cc", while the
> > > sha1() function generates the
> > > "80980fcaf2ab3f243874695f57b2ed065d8e67e4" hash for the "stefano"
> > > string.
>
> > > Am I doing something wrong?
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > > with their CakePHP related questions.
>
> > > 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.comFor
> > >  more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> > --
> > Regards,
> > Zaky Katalan-Ezra
> > QA Administratorwww.IGeneriX.com
> > Sites.IGeneriX.com
> > 054-7762312
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: CakePHP Auth Component cannot remember url before authentication

2010-04-19 Thread cricket
On Apr 19, 6:19 am, "Prof. No Time" 
wrote:
> Thanks for the response Cricket, I have dumped my codes below. Please
> assist me. Regards.
>
> My AppController::beforeFilter()
>
> function beforeFilter(){
>   $this->Auth->fields = array('username' => 'username', 'password' =>
> 'passkey');
>   $this->Auth->allow($this->allowedActions);

The above line is unnecessary.

>   $this->Auth->authorize = 'controller';
>   $this->Auth->loginAction = array('controller' => 'users', 'action'
> => 'login');
>   $this->Auth->loginRedirect = array('controller' => 'pages', 'action'
> => 'display', 'home');
>   $this->Auth->logoutRedirect = '/';
>   $this->Auth->autoRedirect = false;

The above line tells Auth not to call its own redirect() method, even
though the redirect var is set.

>
> }
>
> My UsersController::login()
>
> if ($this->Auth->user()) {
>     if (!empty($this->data)) {
>       $this->Session->setFlash('You have been logged in
> successfully');
>       $this->_postLoginOperations(); //This method redirects the user
> based on role
>       $this->data = array();
>     }
>     $this->redirect($this->Auth->redirect());

This is maybe a problem. You're instructing Auth to redirect if
there's no submitted data. IOW, the first time the login view is
displayed. That's what it looks like, anyway.

But I can't say more without knowing what _postLoginOperations() does.

When you say it doesn't work, do you mean that Auth is sending you
somewhere other than pages->display->home? Or that you're seeing an
endless loop? Something else?

Believe me--I know that Auth can be pretty darned confusing.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: CakePHP Auth Component cannot remember url before authentication

2010-04-19 Thread Prof. No Time
Thanks for the response Cricket, I have dumped my codes below. Please
assist me. Regards.

My AppController::beforeFilter()

function beforeFilter(){
  $this->Auth->fields = array('username' => 'username', 'password' =>
'passkey');
  $this->Auth->allow($this->allowedActions);
  $this->Auth->authorize = 'controller';
  $this->Auth->loginAction = array('controller' => 'users', 'action'
=> 'login');
  $this->Auth->loginRedirect = array('controller' => 'pages', 'action'
=> 'display', 'home');
  $this->Auth->logoutRedirect = '/';
  $this->Auth->autoRedirect = false;
}

My UsersController::login()

if ($this->Auth->user()) {
if (!empty($this->data)) {
  $this->Session->setFlash('You have been logged in
successfully');
  $this->_postLoginOperations(); //This method redirects the user
based on role
  $this->data = array();
}
$this->redirect($this->Auth->redirect());
}



On Apr 16, 11:55 am, cricket  wrote:
> On Apr 16, 1:40 am, "Prof. No Time" 
> wrote:
>
> > In the cook book, we are told that theauthcomponentuses the session
> >componenttoremembertheurlthe user intended to visit and hence
> > when authenticated, automatically takes the user there. However, this
> > DOES NOT WORK for me (cake 1.2.5). What could be the problem?
>
> What does your AppController::beforeFilter() look like? Specifically,
> do you have $this->Auth->autoRedirect = false? Do you have any code in
> UsersController::login() or is it empty?
>
> Check out the newCakePHPQuestions sitehttp://cakeqs.organd help others with 
> theirCakePHPrelated questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Problem with Auth Component hashes

2010-04-19 Thread WebbedIT
If wanting to compare your hashed password with a salt inflected
hashed string use

if ($password == $this->Auth->password($password_confirm))

or

if ($password == Security::hash(Configure::read('Security.salt') .
$password_confirm)

HTH

Paul

On Apr 18, 5:24 pm, Zaky Katalan-Ezra  wrote:
>  I think the Auth uses a salt.
>
> On Sun, Apr 18, 2010 at 6:43 PM, Stefano Martins wrote:
>
>
>
> > Hello folks,
>
> > As I was studying CakePHP and the Auth Component, I've found out that
> > it's not using sha1 hashes - or at least it doesn't seems to - by
> > default. I had to manually set it to use md5 hashes, following the
> > instructions given by the Cookbook. For the string "stefano", Cake's
> > generating the "35b914b05db99937e255f0eaebd3ac89f804a1cc", while the
> > sha1() function generates the
> > "80980fcaf2ab3f243874695f57b2ed065d8e67e4" hash for the "stefano"
> > string.
>
> > Am I doing something wrong?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > 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.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> --
> Regards,
> Zaky Katalan-Ezra
> QA Administratorwww.IGeneriX.com
> Sites.IGeneriX.com
> 054-7762312
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Auth Component: Allow action in a controller but disallow it in another

2010-04-19 Thread WebbedIT
Can we assume you have set $this->Auth->allow('referrals'), at an
application level (/app/app_controller.php)

If so add $this->Auth->deny('referrals') in your User and Staff
controllers.

HTH

Paul.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Problem with Auth Component hashes

2010-04-18 Thread Zaky Katalan-Ezra
 I think the Auth uses a salt.

On Sun, Apr 18, 2010 at 6:43 PM, Stefano Martins wrote:

> Hello folks,
>
> As I was studying CakePHP and the Auth Component, I've found out that
> it's not using sha1 hashes - or at least it doesn't seems to - by
> default. I had to manually set it to use md5 hashes, following the
> instructions given by the Cookbook. For the string "stefano", Cake's
> generating the "35b914b05db99937e255f0eaebd3ac89f804a1cc", while the
> sha1() function generates the
> "80980fcaf2ab3f243874695f57b2ed065d8e67e4" hash for the "stefano"
> string.
>
> Am I doing something wrong?
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Regards,
Zaky Katalan-Ezra
QA Administrator
www.IGeneriX.com
Sites.IGeneriX.com
054-7762312

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Problem with Auth Component hashes

2010-04-18 Thread John Andersen
It is probably related to the salt value in the configuration that
CakePHP is using!
Which is also why I get yet another sha1 hash for "stefano" in my
application :)
Enjoy,
   John

On Apr 18, 6:43 pm, Stefano Martins  wrote:
> Hello folks,
>
> As I was studying CakePHP and the Auth Component, I've found out that
> it's not using sha1 hashes - or at least it doesn't seems to - by
> default. I had to manually set it to use md5 hashes, following the
> instructions given by the Cookbook. For the string "stefano", Cake's
> generating the "35b914b05db99937e255f0eaebd3ac89f804a1cc", while the
> sha1() function generates the
> "80980fcaf2ab3f243874695f57b2ed065d8e67e4" hash for the "stefano"
> string.
>
> Am I doing something wrong?
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Problem with Auth Component hashes

2010-04-18 Thread Stefano Martins
Hello folks,

As I was studying CakePHP and the Auth Component, I've found out that
it's not using sha1 hashes - or at least it doesn't seems to - by
default. I had to manually set it to use md5 hashes, following the
instructions given by the Cookbook. For the string "stefano", Cake's
generating the "35b914b05db99937e255f0eaebd3ac89f804a1cc", while the
sha1() function generates the
"80980fcaf2ab3f243874695f57b2ed065d8e67e4" hash for the "stefano"
string.

Am I doing something wrong?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: CakePHP Auth Component cannot remember url before authentication

2010-04-16 Thread cricket
On Apr 16, 1:40 am, "Prof. No Time" 
wrote:
> In the cook book, we are told that the auth component uses the session
> component to remember the url the user intended to visit and hence
> when authenticated, automatically takes the user there. However, this
> DOES NOT WORK for me (cake 1.2.5). What could be the problem?

What does your AppController::beforeFilter() look like? Specifically,
do you have $this->Auth->autoRedirect = false? Do you have any code in
UsersController::login() or is it empty?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Auth Component: Allow action in a controller but disallow it in another

2010-04-16 Thread John Andersen
Take a look at the message:
http://groups.google.com/group/cake-php/browse_thread/thread/e53fafc5c33dbe6a/543251f6349d373b?#543251f6349d373b
which is not about the same topic, but Crickets example and
explanation is certainly related to your issue.
Enjoy,
   John

On Apr 16, 10:28 am, "Prof. No Time" 
wrote:
> Hello,
>
> Please I have an action named "referrals", I wish to allow this action
> in the guestscontroller without authentication but I have a similar
> action in the userscontroller and the staffscontroller. I DO NOT wish
> to change the action (vis-a-vis url format) name for LEGACY reasons.
> The Auth component keeps allowing my users and staffs referral pages
> access without authentication. This is understandable though. The
> question now is how do I achieve this feat?
>
> Thank You.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Auth Component: Allow action in a controller but disallow it in another

2010-04-16 Thread Prof. No Time
Hello,

Please I have an action named "referrals", I wish to allow this action
in the guestscontroller without authentication but I have a similar
action in the userscontroller and the staffscontroller. I DO NOT wish
to change the action (vis-a-vis url format) name for LEGACY reasons.
The Auth component keeps allowing my users and staffs referral pages
access without authentication. This is understandable though. The
question now is how do I achieve this feat?

Thank You.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


CakePHP Auth Component cannot remember url before authentication

2010-04-15 Thread Prof. No Time
In the cook book, we are told that the auth component uses the session
component to remember the url the user intended to visit and hence
when authenticated, automatically takes the user there. However, this
DOES NOT WORK for me (cake 1.2.5). What could be the problem?

Thank you.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Auth component and roles

2010-04-08 Thread Jeremy Burns
I engaged my brain and solved this:

$this->Session->write('Auth.User.role', $role);

Jeremy Burns
jeremybu...@me.com
(Skype) +44 208 123 3822 (jeremy_burns)
(m) +44 7973 481949
(h) +44 208 530 7573

On 8 Apr 2010, at 12:30, Jeremy Burns wrote:

> Everything I have read about the Auth component uses a 'role' column
> in the users table. I want to store a role_id and have a related
> 'roles' table instead. Is it possible to store the value in the 'name'
> column of the roles table in the Auth->User variable so that I can
> retrieve it via $this->Auth->user('role')?
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> 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 For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en
> 
> To unsubscribe, reply using "remove me" as the subject.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Auth component and roles

2010-04-08 Thread Jeremy Burns
Everything I have read about the Auth component uses a 'role' column
in the users table. I want to store a role_id and have a related
'roles' table instead. Is it possible to store the value in the 'name'
column of the roles table in the Auth->User variable so that I can
retrieve it via $this->Auth->user('role')?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe, reply using "remove me" as the subject.


Auth component not returning expected array key??

2010-03-19 Thread Michael Gaiser
So I am currently trying to migrate to Cake 1.3RC2. Everything is going
well, except the array that is being returned when I call
$this->Auth->user(). If I am navigating to my user page, the array key is:

Array ( [User] => Array ( etc..))

But when I am navigating to any of my other pages it comes in as:

Array ( [user] => Array ( etc..))

All the data is the same, only the main array has a capitalized key. I admit
I have not touched this code in a while, but does anyone have any idea why
the Auth would set that differently? Thanks.


~MG

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: CakePHP Auth-component in AppController

2010-03-05 Thread Robert P
If you have moved all your Auth logic to your AppController you need
to make sure that you are extending the methods in subcontrollers, not
overwriting them.

class UsersController extends AppController {
public function beforeFilter() {
parent::beforeFilter(); // extended
// custom logic
}
}

Permanent redirects after changes to Auth are almost always related to
the configuration.

--
Varisan International 

On Mar 4, 11:27 pm, LDSign  wrote:
> Hi
>
> Ive implemented the login-logic with help of Auth. This works fine.
> But I would like to have auth all over my site. So I would like to
> include this component to the AppController (for global access). As
> soon as I do so, the site stops working. The page will load for some
> seconds and then there comes blank page with a redirect-error (sorry
> Ive this only in german):
>
> "Diese Webseite weist eine Weiterleitung auf.
>
> Die Webseite unterhttp://localhost/ben/users/loginhat zu viele
> Umleitungen erzeugt. Das Löschen Ihrer Cookies für diese Website oder
> das Zulassen von Drittanbieter-Cookies könnte das Problem
> möglicherweise beheben. Sollte das Problem damit nicht behoben sein,
> liegt möglicherweise ein Serverkonfigurationsfehler und kein Problem
> mit Ihrem Computer vor."
>
> This drives my nuts. Do you have any hint? Until now Ive thought that
> when I move my components from the (sub-)controller to the
> AppController that this doesnt make any change execpt for accessing it
> globally.
>
> I use cakePHP 1.3 - latest beta. Are there any known issues?
>
> Thank you,
> Frank

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: CakePHP Auth-component in AppController

2010-03-04 Thread Miles J
What does your beforeFilter look like?

Make sure your not allowing the login page.

On Mar 4, 7:27 am, LDSign  wrote:
> Hi
>
> Ive implemented the login-logic with help of Auth. This works fine.
> But I would like to have auth all over my site. So I would like to
> include this component to the AppController (for global access). As
> soon as I do so, the site stops working. The page will load for some
> seconds and then there comes blank page with a redirect-error (sorry
> Ive this only in german):
>
> "Diese Webseite weist eine Weiterleitung auf.
>
> Die Webseite unterhttp://localhost/ben/users/loginhat zu viele
> Umleitungen erzeugt. Das Löschen Ihrer Cookies für diese Website oder
> das Zulassen von Drittanbieter-Cookies könnte das Problem
> möglicherweise beheben. Sollte das Problem damit nicht behoben sein,
> liegt möglicherweise ein Serverkonfigurationsfehler und kein Problem
> mit Ihrem Computer vor."
>
> This drives my nuts. Do you have any hint? Until now Ive thought that
> when I move my components from the (sub-)controller to the
> AppController that this doesnt make any change execpt for accessing it
> globally.
>
> I use cakePHP 1.3 - latest beta. Are there any known issues?
>
> Thank you,
> Frank

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


CakePHP Auth-component in AppController

2010-03-04 Thread LDSign
Hi

Ive implemented the login-logic with help of Auth. This works fine.
But I would like to have auth all over my site. So I would like to
include this component to the AppController (for global access). As
soon as I do so, the site stops working. The page will load for some
seconds and then there comes blank page with a redirect-error (sorry
Ive this only in german):

"Diese Webseite weist eine Weiterleitung auf.

Die Webseite unter http://localhost/ben/users/login hat zu viele
Umleitungen erzeugt. Das Löschen Ihrer Cookies für diese Website oder
das Zulassen von Drittanbieter-Cookies könnte das Problem
möglicherweise beheben. Sollte das Problem damit nicht behoben sein,
liegt möglicherweise ein Serverkonfigurationsfehler und kein Problem
mit Ihrem Computer vor."

This drives my nuts. Do you have any hint? Until now Ive thought that
when I move my components from the (sub-)controller to the
AppController that this doesnt make any change execpt for accessing it
globally.

I use cakePHP 1.3 - latest beta. Are there any known issues?

Thank you,
Frank

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Auth component not working as expected

2010-02-14 Thread Guillermo Mansilla

Tell me how did you set the authorized var

Enviado desde mi iPhone

El 14/02/2010, a las 02:39, leon  escribió:


Hi,

I'm trying to use Auth component for
parent::beforeFilter();
$this->Auth->allow('*');
But its redirecting to the login page.

Even I tried to do
$this->Auth->allow('home');
its not working at all.

Did I miss anything?
Any help will be highly appreciated.

Thanks,

Check out the new CakePHP Questions site http://cakeqs.org and help  
others with their CakePHP related questions.


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 For more options, visit this  
group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Auth component not working as expected

2010-02-14 Thread leon
Hi,

I'm trying to use Auth component for
parent::beforeFilter();
$this->Auth->allow('*');
But its redirecting to the login page.

Even I tried to do
$this->Auth->allow('home');
its not working at all.

Did I miss anything?
Any help will be highly appreciated.

Thanks,

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: auth component on 2 models?

2009-11-20 Thread Dave
I think typically the better implementation would be to use the same model
and use ACL to determine permissions.  This is pretty complicated though.

Too accomplish what you are talking about you can use the userModel variable
from the Auth component:
http://book.cakephp.org/view/248/AuthComponent-Variables

You would set it in the beforeFilter of the controller which you want to use
that model. ie.

users_controller.php
beforeFilter() {
   $this->Auth->userModel = 'User';
}

clients_controller.php
beforeFilter() {
   $this->Auth->userModel = 'Client';
}

On Fri, Nov 20, 2009 at 9:38 AM, K3  wrote:

> Hi,
> i have users model (for content management administrators) and clients
> model (for registered clients).
>
> Can i use the same Auth compoennt for both models (to allow them to
> login/register)? or i need different approach?
> Any examples/help?
>
> thanks.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-...@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/cake-php?hl=.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-...@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=.




auth component on 2 models?

2009-11-20 Thread K3
Hi,
i have users model (for content management administrators) and clients
model (for registered clients).

Can i use the same Auth compoennt for both models (to allow them to
login/register)? or i need different approach?
Any examples/help?

thanks.

--

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-...@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=.




Auth component IE (Internet explorer) cache problem (Session gets destroy in IE)

2009-11-19 Thread pankaj
I am using auth component for user authentication. I am creating force
logout functionality in my application. If user with same username and
password logged in from one machine and another user try to log in
using same user name and password from another machine. he/she will
see force logout option under login form. if he/she click on that.
first user gets logout. I am doing this using database table. above
functionality works great in firefox but not in IE 7. In IE when i
click on force logout, auth gives me na error "You are not authorized
to access that location."
Apache log gives me 302 error.


I have changed following part of session in core.php but still it is
not working ...
Configure::write('Security.level', 'low');
Configure::write('Session.checkAgent', false);

And following are unchanged sessions configuration from core.php
Configure::write('Session.save', 'php');
Configure::write('Session.cookie', 'CAKEPHP');
Configure::write('Session.timeout', '120');
Configure::write('Session.start', true);
---
[B]AppController[/B]
[CODE]
class AppController extends Controller
{
var $components = array('Auth', 'Cookie', 'RequestHandler');

var $helpers = array('Html', 'Form', 'Javascript',
'Ajax','Time');

function beforeFilter()
{
$this->Auth->loginRedirect = array('plugin' =>
null,'controller' => 'questions', 'action' => 'home');
$this->Auth->logoutRedirect = array('plugin' =>
null,'controller'=> 'users', 'action' => 'login');
$this->Auth->allow('signup', 'confirm', 'home',
'show','questionlist');

$this->Auth->authorize = 'controller';

$this->Auth->userScope = array('User.confirmed' =>
'1');
$this->set('loggedIn', $this->Auth->user('id'));
$this->Auth->autoRedirect = false;
$this->Cookie->name = 'QuickWall';
 if(!$this->Auth->user('id'))
{
$cookie = $this->Cookie->read('User');
if($cookie)
{
$this->Auth->login($cookie);
}
}
else
{
if(!ClassRegistry::init('TrackSession')-
>getMyAccess($this->Auth->user('id'),$this->Session->id()) && $this-
>params['action'] !='forceLogout' && !$this->RequestHandler->isAjax())
{
$this->redirect($this->Auth->logout
());
}
}
}
[/CODE]
UserController.php login action
[CODE] function login()
  {

if ($this->Auth->user())
{
if (!empty($this->data))
{
$this->User->set($this->data);
if (empty($this->data['User']['remember_me']))
{
$this->Cookie->del('User');
}
else
{
$cookie = array();
$cookie['username'] = $this->data
['User']['username'];
$cookie['password'] = $this->data
['User']['password'];
$this->Cookie->write('User', $cookie,
true,'+2 weeks');
}
   unset($this->data['User']['remember_me']);

$this->Session->write('username', $this->data
['User']['username']);

if(!ClassRegistry::init('TrackSession')-
>getMyStatus($this->Auth->user('id')))
{

$this->User->logTrackSession($this-
>Auth->user('id'),
$this->data
['User']['username'],
$this->Session-
>id(),
$

Re: Invalid argument using Auth Component

2009-11-05 Thread John Andersen

Check that the variable $thisPermissions contain an array and that it
is not empty!
pr($thisPermissions)

Maybe you don't need the line:
$thisPermissions = $thisPermissions['Permission'];

Enjoy,
   John

On Nov 6, 12:03 am, damanlovett  wrote:
> I'm using the tutorial CakePHP Auth Component - Users, Groups &
> Permissions Revisited
>
> The error I'm getting is
>
> Warning (2): Invalid argument supplied for foreach() [APP/
> app_controller.php, line 98]
>
> The code for the line error is
>
>                 $thisPermissions = $thisPermissions['Permission'];
>                 foreach($thisPermissions as $thisPermission){
>                     $permissions[]=$thisPermission['name'];
>                 }
>
> Which seems like no information is being passed to the loop.
>
> Can any one help me figure out why information isn't being passed to
> the loop?
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth Component does not logout via URL

2009-11-05 Thread robustsolution

m really sorry for the delay but I really misunderstood the question

I don't know if you mean this

http://book.cakephp.org/view/431/disableCache


On Nov 4, 3:40 pm, "Prof. No Time" 
wrote:
> Thanks very very much RobustSolution, I have applied your logic. Its
> ok though I didn't use the "famous" remember me here checkbox. I have
> studied the issue and finally discovered that it is a fault of the
> BUGGY INTERNET EXPLORER that keeps CACHING the page instead of
> visiting the SERVER for proper details (Stupid Explorer!!!). Please
> can you help me out on how to prevent caching of the LOGOUT page by
> such browsers?
>
> Cheers in ADV.
>
> On Nov 2, 3:29 pm, robustsolution  wrote:
>
> > Prof.NoTime
>
> > try to take a coffee cup and get relaxed, this is my current solution/
> > tips/tricks for the moment
>
> > 1)put this in your AppController class
> > final protected function _logout() {
> >         if (!empty($this->Cookie)) {
> >                 //this ensures if you were using the Cookie component along 
> > with the
> > Auth component (the famous remember me checkbox)
> >                 //and you have saved the credentials inside cookie
> >                 //you should delete the credentials from the cookie when 
> > you log out
> >                 //noneed to verify if you have already saved the 
> > credentials inside
> > cookie,noerror is thrown
> >                 $this->Cookie->del($this->Auth->sessionKey);
> >         }
> >         return $this->Auth->logout();
>
> > }
>
> > 2)your UsersController class logout() method should be now like this
> > public function logout() {
> >         $this->redirect($this->_logout());
>
> > }
>
> > 3)your UsersController class beforeFilter() method/callback should be
> > now like this
> > public function beforeFilter() {
> >         ...
> >         parent::beforeFilter();
> >         //please specify the always allowed actions... logout should be the
> > first one of course
> >         $this->Auth->allow
> > ('logout','forgotpassword','resetpassword','activate','register'/* put
> > here any other always-allowed action*/);
> >         if ($this->Auth->user()) {
> >                 if (in_array($this->params['action'],array
> > ('forgotpassword','resetpassword','register','activate'))) {
> >                         //if you are forgetting your password,
> >                         //if you resetting your password,
> >                         //if you are registering as a new user,
> >                         //or if you are activating you new accout via url
> >                         //you should not be logged in ... yea this is logic
> >                         $this->_logout();
> >                 } elseif($this->params['action']=='login') {
> >                         //you are already logged in,noneed to login again
> >                         $this->redirect($this->Auth->redirect());
> >                 }
> >         } elseif ($this->params['action']=='logout') {
> >                 //you are already logged out,noneed to log out again
> >                 $this->redirect($this->Auth->redirect());
> >         }
> >         ...
>
> > }
>
> > now have a nice baking day
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Invalid argument using Auth Component

2009-11-05 Thread damanlovett

I'm using the tutorial CakePHP Auth Component - Users, Groups &
Permissions Revisited

The error I'm getting is

Warning (2): Invalid argument supplied for foreach() [APP/
app_controller.php, line 98]



The code for the line error is

$thisPermissions = $thisPermissions['Permission'];
foreach($thisPermissions as $thisPermission){
$permissions[]=$thisPermission['name'];
}

Which seems like no information is being passed to the loop.

Can any one help me figure out why information isn't being passed to
the loop?


--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth Component does not logout via URL

2009-11-04 Thread Prof. No Time

Thanks very very much RobustSolution, I have applied your logic. Its
ok though I didn't use the "famous" remember me here checkbox. I have
studied the issue and finally discovered that it is a fault of the
BUGGY INTERNET EXPLORER that keeps CACHING the page instead of
visiting the SERVER for proper details (Stupid Explorer!!!). Please
can you help me out on how to prevent caching of the LOGOUT page by
such browsers?

Cheers in ADV.

On Nov 2, 3:29 pm, robustsolution  wrote:
> Prof.NoTime
>
> try to take a coffee cup and get relaxed, this is my current solution/
> tips/tricks for the moment
>
> 1)put this in your AppController class
> final protected function _logout() {
>         if (!empty($this->Cookie)) {
>                 //this ensures if you were using the Cookie component along 
> with the
> Auth component (the famous remember me checkbox)
>                 //and you have saved the credentials inside cookie
>                 //you should delete the credentials from the cookie when you 
> log out
>                 //noneed to verify if you have already saved the credentials 
> inside
> cookie,noerror is thrown
>                 $this->Cookie->del($this->Auth->sessionKey);
>         }
>         return $this->Auth->logout();
>
> }
>
> 2)your UsersController class logout() method should be now like this
> public function logout() {
>         $this->redirect($this->_logout());
>
> }
>
> 3)your UsersController class beforeFilter() method/callback should be
> now like this
> public function beforeFilter() {
>         ...
>         parent::beforeFilter();
>         //please specify the always allowed actions... logout should be the
> first one of course
>         $this->Auth->allow
> ('logout','forgotpassword','resetpassword','activate','register'/* put
> here any other always-allowed action*/);
>         if ($this->Auth->user()) {
>                 if (in_array($this->params['action'],array
> ('forgotpassword','resetpassword','register','activate'))) {
>                         //if you are forgetting your password,
>                         //if you resetting your password,
>                         //if you are registering as a new user,
>                         //or if you are activating you new accout via url
>                         //you should not be logged in ... yea this is logic
>                         $this->_logout();
>                 } elseif($this->params['action']=='login') {
>                         //you are already logged in,noneed to login again
>                         $this->redirect($this->Auth->redirect());
>                 }
>         } elseif ($this->params['action']=='logout') {
>                 //you are already logged out,noneed to log out again
>                 $this->redirect($this->Auth->redirect());
>         }
>         ...
>
> }
>
> now have a nice baking day
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth Component does not logout via URL

2009-11-02 Thread robustsolution

Prof.No Time

try to take a coffee cup and get relaxed, this is my current solution/
tips/tricks for the moment

1)put this in your AppController class
final protected function _logout() {
if (!empty($this->Cookie)) {
//this ensures if you were using the Cookie component along 
with the
Auth component (the famous remember me checkbox)
//and you have saved the credentials inside cookie
//you should delete the credentials from the cookie when you 
log out
//no need to verify if you have already saved the credentials 
inside
cookie, no error is thrown
$this->Cookie->del($this->Auth->sessionKey);
}
return $this->Auth->logout();
}

2)your UsersController class logout() method should be now like this
public function logout() {
$this->redirect($this->_logout());
}

3)your UsersController class beforeFilter() method/callback should be
now like this
public function beforeFilter() {
...
parent::beforeFilter();
//please specify the always allowed actions... logout should be the
first one of course
$this->Auth->allow
('logout','forgotpassword','resetpassword','activate','register'/* put
here any other always-allowed action*/);
if ($this->Auth->user()) {
if (in_array($this->params['action'],array
('forgotpassword','resetpassword','register','activate'))) {
//if you are forgetting your password,
//if you resetting your password,
//if you are registering as a new user,
//or if you are activating you new accout via url
//you should not be logged in ... yea this is logic
$this->_logout();
} elseif($this->params['action']=='login') {
//you are already logged in, no need to login again
$this->redirect($this->Auth->redirect());
}
} elseif ($this->params['action']=='logout') {
//you are already logged out, no need to log out again
$this->redirect($this->Auth->redirect());
}
...
}

now have a nice baking day
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Auth Component does not logout via URL

2009-11-01 Thread Prof. No Time

Good day all,

Please, I have a little problem with my AUTH component. I am using the
default AUTH component in 1.2.5. I discovered that when I login to my
app and then try to log  out by typing the logout url: 
http://localhost/myapp/logout
(which is routed to myapp/users/logout), the auth component simply
refuses to logout (instead it gives me the deny message: You are not
authorized to bla bla bla...). It also presents me with the login form
to authorize me. The funniest part is that if I then enter my
credentials, I am then logged out. (Imagine entering username and
password to log out of an application, isn't that sickening?)

However, when I click on logout link from within a page, it logs out
correctly. What could be the cause of this?
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cakephp auth component allow problem

2009-10-24 Thread robustsolution

Dear @Zahidur,

to allow any kind of requestAction from within your AppController do
this in the beforeFilter() callback

if (array_key_exists('requested',$this->params)) {
$this->Auth->allow($this->params['action']);
}

this is a quick solution for now. and it works for me with no error.
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cakephp auth component allow problem

2009-10-23 Thread jayarjo


Since no one have responded. I guess you'll have just to test it.
Doing it in app_controller.php only can be tricky, if not impossible.
Theoretically it is possible to check for current controller in
app_controller.php. Not sure if that's supported in cake though. And
it will be more logical if you deny access in child controller rather
then in app_controller.php.

On Oct 22, 3:15 pm, Zahidur Rahman  wrote:
> I also thought such way.but i wanted to do all the think in
> app_controller.php.
> Ok. thanks for suggestion.
>
> 2009/10/22 jayarjo 
>
>
>
> > > hmm it's working if i use array. I am using version 1.2
> > > I hope my query was confusing for u.
>
> > Probably it will work either way.
>
> > Oh, that's interesting by the way. I guess we can allow access for
> > common actions in app_controller.php, right? Correct me please if not,
> > I'm total newbie on cake yet. What will happen if we deny access to a
> > specific common action in a particular controller? Will this rule
> > override the one defined in app_controller.php?
>
> > On Oct 22, 7:34 am, Zahidur Rahman  wrote:
> > > hmm it's working if i use array. I am using version 1.2
> > > I hope my query was confusing for u.
>
> > > say i want to give access for controller articles and action detail for
> > > every one
> > > but say for controller posts and action detail i want to restrict for
> > > registered user only.
> > > then what i have to do ??
>
> > > Thanks for response .
> > > Regards
> > > zahid
>
> > > On Thu, Oct 22, 2009 at 10:14 AM, 默  wrote:
>
> > > > Might you not need to use array, just write like blow:
>
> > > > $this->Auth->allow('register', 'confirm', 'forget',
> > > > 'activate','reset', 'login','logout');
>
> > > > Try it^^!
>
> > > > On 10月22日, 上午10時04分, Zahidur Rahman  wrote:
> > > > > Hi ,
> > > > > How it is possible for me to allow plugins , controllers wise action
> > > > > permission in cakephp auth allow method..
>
> > > > >  $this->Auth->allow(array('register', 'confirm', 'forget',
> > > > > 'activate','reset', 'login','logout'));
>
> > > > > Thanks in advance
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cakephp auth component allow problem

2009-10-22 Thread Zahidur Rahman
I also thought such way.but i wanted to do all the think in
app_controller.php.
Ok. thanks for suggestion.


2009/10/22 jayarjo 

>
>
> > hmm it's working if i use array. I am using version 1.2
> > I hope my query was confusing for u.
>
> Probably it will work either way.
>
> Oh, that's interesting by the way. I guess we can allow access for
> common actions in app_controller.php, right? Correct me please if not,
> I'm total newbie on cake yet. What will happen if we deny access to a
> specific common action in a particular controller? Will this rule
> override the one defined in app_controller.php?
>
> On Oct 22, 7:34 am, Zahidur Rahman  wrote:
> > hmm it's working if i use array. I am using version 1.2
> > I hope my query was confusing for u.
> >
> > say i want to give access for controller articles and action detail for
> > every one
> > but say for controller posts and action detail i want to restrict for
> > registered user only.
> > then what i have to do ??
> >
> > Thanks for response .
> > Regards
> > zahid
> >
> > On Thu, Oct 22, 2009 at 10:14 AM, 默  wrote:
> >
> > > Might you not need to use array, just write like blow:
> >
> > > $this->Auth->allow('register', 'confirm', 'forget',
> > > 'activate','reset', 'login','logout');
> >
> > > Try it^^!
> >
> > > On 10月22日, 上午10時04分, Zahidur Rahman  wrote:
> > > > Hi ,
> > > > How it is possible for me to allow plugins , controllers wise action
> > > > permission in cakephp auth allow method..
> >
> > > >  $this->Auth->allow(array('register', 'confirm', 'forget',
> > > > 'activate','reset', 'login','logout'));
> >
> > > > Thanks in advance
> >
>

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cakephp auth component allow problem

2009-10-22 Thread jayarjo


> hmm it's working if i use array. I am using version 1.2
> I hope my query was confusing for u.

Probably it will work either way.

Oh, that's interesting by the way. I guess we can allow access for
common actions in app_controller.php, right? Correct me please if not,
I'm total newbie on cake yet. What will happen if we deny access to a
specific common action in a particular controller? Will this rule
override the one defined in app_controller.php?

On Oct 22, 7:34 am, Zahidur Rahman  wrote:
> hmm it's working if i use array. I am using version 1.2
> I hope my query was confusing for u.
>
> say i want to give access for controller articles and action detail for
> every one
> but say for controller posts and action detail i want to restrict for
> registered user only.
> then what i have to do ??
>
> Thanks for response .
> Regards
> zahid
>
> On Thu, Oct 22, 2009 at 10:14 AM, 默  wrote:
>
> > Might you not need to use array, just write like blow:
>
> > $this->Auth->allow('register', 'confirm', 'forget',
> > 'activate','reset', 'login','logout');
>
> > Try it^^!
>
> > On 10月22日, 上午10時04分, Zahidur Rahman  wrote:
> > > Hi ,
> > > How it is possible for me to allow plugins , controllers wise action
> > > permission in cakephp auth allow method..
>
> > >  $this->Auth->allow(array('register', 'confirm', 'forget',
> > > 'activate','reset', 'login','logout'));
>
> > > Thanks in advance
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cakephp auth component allow problem

2009-10-21 Thread Zahidur Rahman
hmm it's working if i use array. I am using version 1.2
I hope my query was confusing for u.

say i want to give access for controller articles and action detail for
every one
but say for controller posts and action detail i want to restrict for
registered user only.
then what i have to do ??

Thanks for response .
Regards
zahid


On Thu, Oct 22, 2009 at 10:14 AM, 默  wrote:

>
> Might you not need to use array, just write like blow:
>
> $this->Auth->allow('register', 'confirm', 'forget',
> 'activate','reset', 'login','logout');
>
> Try it^^!
>
> On 10月22日, 上午10時04分, Zahidur Rahman  wrote:
> > Hi ,
> > How it is possible for me to allow plugins , controllers wise action
> > permission in cakephp auth allow method..
> >
> >  $this->Auth->allow(array('register', 'confirm', 'forget',
> > 'activate','reset', 'login','logout'));
> >
> > Thanks in advance
> >
>

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cakephp auth component allow problem

2009-10-21 Thread

Might you not need to use array, just write like blow:

$this->Auth->allow('register', 'confirm', 'forget',
'activate','reset', 'login','logout');

Try it^^!

On 10月22日, 上午10時04分, Zahidur Rahman  wrote:
> Hi ,
> How it is possible for me to allow plugins , controllers wise action
> permission in cakephp auth allow method..
>
>  $this->Auth->allow(array('register', 'confirm', 'forget',
> 'activate','reset', 'login','logout'));
>
> Thanks in advance
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Cakephp auth component allow problem

2009-10-21 Thread Zahidur Rahman
Hi ,
How it is possible for me to allow plugins , controllers wise action
permission in cakephp auth allow method..

 $this->Auth->allow(array('register', 'confirm', 'forget',
'activate','reset', 'login','logout'));

Thanks in advance

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



ajax and auth component: logs out when multiple ajax requests are made

2009-10-20 Thread bMilesp

Hello, i have 2 ajax requests (SWFUpload and a jquery imageScroller
plugin). when i do one of the two requests, works fine. When i do the
other request, the session is never set and it logs out.

I have Security.level = 'medium' in core.php.

the cookie is sent in both request headers; i can debug( $_COOKIE) and
it displays.

it doesn't matter which request i send first (eg: SWFUpload), it will
work. the second request i send (eg: imageScroller) will NOT work.

i can send the same ajax request over and over and it will work. Once
i send the other ajax request, i will be logged out.

if i pass a session id and do this:

$this->Session->id($this->params['pass'][1]);
$this->Session->start();

does not create the User $_SESSION var.

any other ideas? thank you. -b

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth component and which fields must be saved in session

2009-10-17 Thread robustsolution

you have two choices
either you hack your customized/personalized \app\controllers
\components\auth.php file (not recommened if you are not expert and if
you do not need it as in this case)

ORR

you have to put it in a controller callback so a check done one time

if (!array_key_exists('requested', $this->params)) {
/*
do here a test on one of the non required (auth user session key)
field if it is still available
if so
delete all the non required 
*/
}


On Oct 17, 3:26 pm, "marco.rizze...@gmail.com"
 wrote:
> Hi
> I use the Auth component to login in my application.
> I have noted that when the login is correct all fields of User model
> are saved in the session.
> How can I do so only some fields are saved in session and the other
> not?
> Thanks
> Marco
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Auth component and which fields must be saved in session

2009-10-17 Thread marco.rizze...@gmail.com

Hi
I use the Auth component to login in my application.
I have noted that when the login is correct all fields of User model
are saved in the session.
How can I do so only some fields are saved in session and the other
not?
Thanks
Marco
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Auth component + extra variables

2009-10-15 Thread jakobjp

Hello

I have a login procedure that requires more information than just the
username and password.

Controller: "employees"
Action: "login"

Databasefields needed for login: email, password, group (because it is
possible to have the same email for different groups).

Login URL: http://mydomain.com/login/group1

When someone makes a failed login attempt, he is redirected to
http://mydomain.com/login instead of http://mydomain.com/login/group1.

How can I make the Auth component redirect the user to .../login/
group1? ("group1" is a variable, it could be anything, which is
checked against the DB)


--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth-Component: Check more than 1 Users-Table (more than 1 User-Model)

2009-10-10 Thread braaan

yeah that was my idea today too... (propably much easier and cleaner
than adding support for another user-model ;))
thank you!
greets

On 9 Okt., 18:26, "Dr. Loboto"  wrote:
> Users and companies have at least 3 common columns - id, login and
> password. Keep them in one table and put specific fields in 2 others.
> Point Auth to 'united' model. That's all.
>
> On Oct 9, 9:26 pm,braaan wrote:
>
> > Hello,
>
> > my currect application has normal User (Employees) and Company models
> > among others.
> >    => Users and companies should be able to login.
> > Users can manage their account and Companies should be able to manage
> > their employees (User).
> > I didn't find a way to check companies- *and* users-table on a new
> > login.
>
> > i thought about extending AuthComponent but i'm not that familiar with
> > cakephp.
>
> > the thing why i need 2 "users"-models is, that User and Company have
> > really different columns.
>
> > do you have an idea how to solve that?
> > thank you very much!
> > greets
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth-Component: Check more than 1 Users-Table (more than 1 User-Model)

2009-10-09 Thread Dr. Loboto

Users and companies have at least 3 common columns - id, login and
password. Keep them in one table and put specific fields in 2 others.
Point Auth to 'united' model. That's all.

On Oct 9, 9:26 pm, braaan  wrote:
> Hello,
>
> my currect application has normal User (Employees) and Company models
> among others.
>    => Users and companies should be able to login.
> Users can manage their account and Companies should be able to manage
> their employees (User).
> I didn't find a way to check companies- *and* users-table on a new
> login.
>
> i thought about extending AuthComponent but i'm not that familiar with
> cakephp.
>
> the thing why i need 2 "users"-models is, that User and Company have
> really different columns.
>
> do you have an idea how to solve that?
> thank you very much!
> greets
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Auth-Component: Check more than 1 Users-Table (more than 1 User-Model)

2009-10-09 Thread braaan

Hello,

my currect application has normal User (Employees) and Company models
among others.
   => Users and companies should be able to login.
Users can manage their account and Companies should be able to manage
their employees (User).
I didn't find a way to check companies- *and* users-table on a new
login.

i thought about extending AuthComponent but i'm not that familiar with
cakephp.

the thing why i need 2 "users"-models is, that User and Company have
really different columns.

do you have an idea how to solve that?
thank you very much!
greets
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth component bug

2009-10-09 Thread euromark (munich)

actually i have been using 0 instead of false or null
works for me

On 8 Okt., 22:03, Miles J  wrote:
> Try setting null instead of false, Cake acts weird sometimes with
> "false".
>
> On Oct 8, 12:05 pm, ben  wrote:
>
> > I was able to overcome this behavior by setting this in my routes.php
>
> > Router::connect('/admin/users/login', array('controller' => 'users',
> > 'action' => 'login'));
>
> > It did the trick for me.  My only issue now is that once the user is
> > logged in they do not go back to the page they were attempting to
> > access but instead are redirected to the root of the site.
>
> > -Benhttp://www.benhavilland.com
>
> > On Oct 8, 8:37 am, ben  wrote:
>
> > > I have the same exact issue and have been searching for a solution for
> > > several days now...
>
> > > On Sep 26, 4:06 am, Marcelo  wrote:
>
> > > > I'm using Auth component and this is one of the settings in my
> > > > AppController's beforeFilter() method:
>
> > > > $this->Auth->loginAction = array(
> > > >                         'controller' => 'users',
> > > >                         'action' => 'login',
> > > >                         Configure::read('Routing.admin') => false
> > > >                 );
>
> > > > When i access:
> > > > --
> > > > "todos/view/5"                redirects to -> "users/login"   GOOD
> > > > --
> > > > "admin/todos/edit/5"      redirects to > "users/login"    GOOD
> > > > --
> > > > "admin/users/add"         redirects to > "admin/users/login"  BAD,
> > > > WHY THIS HAPPENS?!?
> > > > --
>
> > > > I have no admin_login() action. My login action is NOT under admin
> > > > routing.
>
> > > > It should redirect to "users/login" since i've disabled admin prefix
> > > > within my loginAction configuration.
>
> > > > It only happens with Users controller!
>
> > > > I would appreciate an explanation for this strange behavior.
>
> > > > Thanks in advance,
>
> > > > Marcelo Kanzaki
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth component bug

2009-10-08 Thread Miles J

Try setting null instead of false, Cake acts weird sometimes with
"false".

On Oct 8, 12:05 pm, ben  wrote:
> I was able to overcome this behavior by setting this in my routes.php
>
> Router::connect('/admin/users/login', array('controller' => 'users',
> 'action' => 'login'));
>
> It did the trick for me.  My only issue now is that once the user is
> logged in they do not go back to the page they were attempting to
> access but instead are redirected to the root of the site.
>
> -Benhttp://www.benhavilland.com
>
> On Oct 8, 8:37 am, ben  wrote:
>
> > I have the same exact issue and have been searching for a solution for
> > several days now...
>
> > On Sep 26, 4:06 am, Marcelo  wrote:
>
> > > I'm using Auth component and this is one of the settings in my
> > > AppController's beforeFilter() method:
>
> > > $this->Auth->loginAction = array(
> > >                         'controller' => 'users',
> > >                         'action' => 'login',
> > >                         Configure::read('Routing.admin') => false
> > >                 );
>
> > > When i access:
> > > --
> > > "todos/view/5"                redirects to -> "users/login"   GOOD
> > > --
> > > "admin/todos/edit/5"      redirects to > "users/login"    GOOD
> > > --
> > > "admin/users/add"         redirects to > "admin/users/login"  BAD,
> > > WHY THIS HAPPENS?!?
> > > --
>
> > > I have no admin_login() action. My login action is NOT under admin
> > > routing.
>
> > > It should redirect to "users/login" since i've disabled admin prefix
> > > within my loginAction configuration.
>
> > > It only happens with Users controller!
>
> > > I would appreciate an explanation for this strange behavior.
>
> > > Thanks in advance,
>
> > > Marcelo Kanzaki
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth component bug

2009-10-08 Thread ben

I was able to overcome this behavior by setting this in my routes.php

Router::connect('/admin/users/login', array('controller' => 'users',
'action' => 'login'));

It did the trick for me.  My only issue now is that once the user is
logged in they do not go back to the page they were attempting to
access but instead are redirected to the root of the site.

-Ben
http://www.benhavilland.com

On Oct 8, 8:37 am, ben  wrote:
> I have the same exact issue and have been searching for a solution for
> several days now...
>
> On Sep 26, 4:06 am, Marcelo  wrote:
>
> > I'm using Auth component and this is one of the settings in my
> > AppController's beforeFilter() method:
>
> > $this->Auth->loginAction = array(
> >                         'controller' => 'users',
> >                         'action' => 'login',
> >                         Configure::read('Routing.admin') => false
> >                 );
>
> > When i access:
> > --
> > "todos/view/5"                redirects to -> "users/login"   GOOD
> > --
> > "admin/todos/edit/5"      redirects to > "users/login"    GOOD
> > --
> > "admin/users/add"         redirects to > "admin/users/login"  BAD,
> > WHY THIS HAPPENS?!?
> > --
>
> > I have no admin_login() action. My login action is NOT under admin
> > routing.
>
> > It should redirect to "users/login" since i've disabled admin prefix
> > within my loginAction configuration.
>
> > It only happens with Users controller!
>
> > I would appreciate an explanation for this strange behavior.
>
> > Thanks in advance,
>
> > Marcelo Kanzaki
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth component bug

2009-10-08 Thread ben

I have the same exact issue and have been searching for a solution for
several days now...

On Sep 26, 4:06 am, Marcelo  wrote:
> I'm using Auth component and this is one of the settings in my
> AppController's beforeFilter() method:
>
> $this->Auth->loginAction = array(
>                         'controller' => 'users',
>                         'action' => 'login',
>                         Configure::read('Routing.admin') => false
>                 );
>
> When i access:
> --
> "todos/view/5"                redirects to -> "users/login"   GOOD
> --
> "admin/todos/edit/5"      redirects to > "users/login"    GOOD
> --
> "admin/users/add"         redirects to > "admin/users/login"  BAD,
> WHY THIS HAPPENS?!?
> --
>
> I have no admin_login() action. My login action is NOT under admin
> routing.
>
> It should redirect to "users/login" since i've disabled admin prefix
> within my loginAction configuration.
>
> It only happens with Users controller!
>
> I would appreciate an explanation for this strange behavior.
>
> Thanks in advance,
>
> Marcelo Kanzaki

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth component loop redirect

2009-10-03 Thread Bert Van den Brande
Hmm tricky stuff indeed, must remember this one !

On Fri, Oct 2, 2009 at 3:39 PM, brian  wrote:

>
> On Fri, Oct 2, 2009 at 9:36 AM, mathaios  wrote:
> >
> > Brian you nailed it...I was having a small navigation element in the
> > layout
> >
> > thank you!
> >
>
> Yeah, that one was driving me nuts once. I was so happy to find that post!
>
> >
>

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth component loop redirect

2009-10-02 Thread brian

On Fri, Oct 2, 2009 at 9:36 AM, mathaios  wrote:
>
> Brian you nailed it...I was having a small navigation element in the
> layout
>
> thank you!
>

Yeah, that one was driving me nuts once. I was so happy to find that post!

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth component loop redirect

2009-10-02 Thread mathaios

Brian you nailed it...I was having a small navigation element in the
layout

thank you!

On 1 Ott, 17:57, brian  wrote:
> Do you have an requestAction() code? If so, try adding this in
> AppController::beforeFilter()
>
> if (isset($this->params['requested'])) $this->Auth->allow($this->action);
>
> http://thewebandthings.synodicsolutions.com/2009/07/01/increasing-lif...
>
> Also, you should explicitly set $this->Auth->loginRedirect.
>
> On Thu, Oct 1, 2009 at 7:27 AM, mathaios  wrote:
>
> > I'm using the Auth component as the example in the manual, but the log-
> > in form keeps redirecting to himself, and Firefox throws the error
> > "The page isn't redirecting properly".
>
> > My app controller is:
>
> > class AppController extends Controller {
>
> >        var $components=array('Auth','RequestHandler');
>
> >    function beforeFilter() {
> >                $this->Auth->loginAction = array('admin' => false,  
> > 'controller' =>
> > 'users', 'action' => 'login');
> >                //$this->Auth->allow(array('*')); <<- if I uncomment this 
> > line it
> > "works" (allow all)
> >    }
> > }
>
> > my users controller (excerpt) is:
>
> > class UsersController extends AppController {
>
> >        var $name = 'Users';
> >        var $helpers = array('Html', 'Form');
>
> >        function login() {
>
> >        }
>
> >        function logout() {
> >                 $this->redirect($this->Auth->logout());
> >        }
>
> > 
>
> > what I'm doing wrong ?
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth component loop redirect

2009-10-01 Thread brian

Do you have an requestAction() code? If so, try adding this in
AppController::beforeFilter()

if (isset($this->params['requested'])) $this->Auth->allow($this->action);

http://thewebandthings.synodicsolutions.com/2009/07/01/increasing-life-expectancy-with-2-lines-of-code-cakephp-auth-component/

Also, you should explicitly set $this->Auth->loginRedirect.

On Thu, Oct 1, 2009 at 7:27 AM, mathaios  wrote:
>
> I'm using the Auth component as the example in the manual, but the log-
> in form keeps redirecting to himself, and Firefox throws the error
> "The page isn't redirecting properly".
>
> My app controller is:
>
> class AppController extends Controller {
>
>        var $components=array('Auth','RequestHandler');
>
>    function beforeFilter() {
>                $this->Auth->loginAction = array('admin' => false,  
> 'controller' =>
> 'users', 'action' => 'login');
>                //$this->Auth->allow(array('*')); <<- if I uncomment this line 
> it
> "works" (allow all)
>    }
> }
>
> my users controller (excerpt) is:
>
> class UsersController extends AppController {
>
>        var $name = 'Users';
>        var $helpers = array('Html', 'Form');
>
>        function login() {
>
>        }
>
>        function logout() {
>                 $this->redirect($this->Auth->logout());
>        }
>
> 
>
> what I'm doing wrong ?
> >
>

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth component loop redirect

2009-10-01 Thread mathaios

Thank you, but I already did that but did not work :-(



On 1 Ott, 14:06, Bert Van den Brande  wrote:
> Add
>
>     $this->Auth->allow(array('login'));
>
> to your beforeFilter()
>
> Friendly greetings,
> Bert
>
> On Thu, Oct 1, 2009 at 1:27 PM, mathaios  wrote:
>
> > I'm using the Auth component as the example in the manual, but the log-
> > in form keeps redirecting to himself, and Firefox throws the error
> > "The page isn't redirecting properly".
>
> > My app controller is:
>
> > class AppController extends Controller {
>
> >        var $components=array('Auth','RequestHandler');
>
> >    function beforeFilter() {
> >                $this->Auth->loginAction = array('admin' => false,
> >  'controller' =>
> > 'users', 'action' => 'login');
> >                //$this->Auth->allow(array('*')); <<- if I uncomment this
> > line it
> > "works" (allow all)
> >    }
> > }
>
> > my users controller (excerpt) is:
>
> > class UsersController extends AppController {
>
> >        var $name = 'Users';
> >        var $helpers = array('Html', 'Form');
>
> >        function login() {
>
> >        }
>
> >        function logout() {
> >                 $this->redirect($this->Auth->logout());
> >        }
>
> > 
>
> > what I'm doing wrong ?
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth component loop redirect

2009-10-01 Thread Bert Van den Brande
Add

$this->Auth->allow(array('login'));

to your beforeFilter()


Friendly greetings,
Bert

On Thu, Oct 1, 2009 at 1:27 PM, mathaios  wrote:

>
> I'm using the Auth component as the example in the manual, but the log-
> in form keeps redirecting to himself, and Firefox throws the error
> "The page isn't redirecting properly".
>
> My app controller is:
>
> class AppController extends Controller {
>
>var $components=array('Auth','RequestHandler');
>
>function beforeFilter() {
>$this->Auth->loginAction = array('admin' => false,
>  'controller' =>
> 'users', 'action' => 'login');
>//$this->Auth->allow(array('*')); <<- if I uncomment this
> line it
> "works" (allow all)
>}
> }
>
> my users controller (excerpt) is:
>
> class UsersController extends AppController {
>
>var $name = 'Users';
>var $helpers = array('Html', 'Form');
>
>function login() {
>
>}
>
>function logout() {
> $this->redirect($this->Auth->logout());
>}
>
> 
>
> what I'm doing wrong ?
> >
>

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Auth component loop redirect

2009-10-01 Thread mathaios

I'm using the Auth component as the example in the manual, but the log-
in form keeps redirecting to himself, and Firefox throws the error
"The page isn't redirecting properly".

My app controller is:

class AppController extends Controller {

var $components=array('Auth','RequestHandler');

function beforeFilter() {
$this->Auth->loginAction = array('admin' => false,  
'controller' =>
'users', 'action' => 'login');
//$this->Auth->allow(array('*')); <<- if I uncomment this line 
it
"works" (allow all)
}
}

my users controller (excerpt) is:

class UsersController extends AppController {

var $name = 'Users';
var $helpers = array('Html', 'Form');

function login() {

}

function logout() {
 $this->redirect($this->Auth->logout());
}



what I'm doing wrong ?
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Auth component bug

2009-09-26 Thread Marcelo

I'm using Auth component and this is one of the settings in my
AppController's beforeFilter() method:

$this->Auth->loginAction = array(
'controller' => 'users',
'action' => 'login',
Configure::read('Routing.admin') => false
);

When i access:
--
"todos/view/5"redirects to -> "users/login"   GOOD
--
"admin/todos/edit/5"  redirects to > "users/login"GOOD
--
"admin/users/add" redirects to > "admin/users/login"  BAD,
WHY THIS HAPPENS?!?
--

I have no admin_login() action. My login action is NOT under admin
routing.

It should redirect to "users/login" since i've disabled admin prefix
within my loginAction configuration.

It only happens with Users controller!

I would appreciate an explanation for this strange behavior.

Thanks in advance,

Marcelo Kanzaki

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using same Auth component in admin and client

2009-09-25 Thread vinodkalpaka

I have tried this one, this is similar to the previous code. Actually
it should get result, but somehow fails.

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using same Auth component in admin and client

2009-09-24 Thread brian

$admin = Configure::read('Routing.admin');

if (isset($this->params[$admin]) && $this->params[$admin])

But I've no idea if Auth can handle having 2 models like this.

On Thu, Sep 24, 2009 at 7:06 AM, vinodkalpaka  wrote:
>
> How can I use same Auth component in admin and client properly? What
> is the use of $this->Auth->userModel ="modelname" . I am using users
> table in admin side and customers table in client side
>
> I have used the following code in beforeFilter() function of
> AppController
>
> here is the code
> $this->pos = strpos($_SERVER['REQUEST_URI'], "admin");
> if ($this->pos != true)
> $this->Auth->userModel = 'Customer';
> else
> $this->Auth->userModel = 'User';
>
> But this do not work properly.
> I can login to the client panel if Use the line $this->Auth->userModel
> = 'Customer';, but admin panel validation fails.
> Please advice me.
>
> >
>

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Using same Auth component in admin and client

2009-09-24 Thread vinodkalpaka

How can I use same Auth component in admin and client properly? What
is the use of $this->Auth->userModel ="modelname" . I am using users
table in admin side and customers table in client side

I have used the following code in beforeFilter() function of
AppController

here is the code
$this->pos = strpos($_SERVER['REQUEST_URI'], "admin");
if ($this->pos != true)
$this->Auth->userModel = 'Customer';
else
$this->Auth->userModel = 'User';

But this do not work properly.
I can login to the client panel if Use the line $this->Auth->userModel
= 'Customer';, but admin panel validation fails.
Please advice me.

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: "Login failed. Invalid username or password." in Auth Component

2009-09-21 Thread Wladiston Paiva
i found the solution.

thnx
---
Wladiston Maurício de Paiva
http://wladistonpaiva.com.br
desenvolvedo...@gmail.com
e...@wladistonpaiva.com.br
+55 (31) 8435 - 5380


2009/9/21 Wladiston Paiva 

> http://www.cakephpforum.net/index.php?showtopic=1709&st=0&#entry6282
>
> up!
>
> ---
> Wladiston Maurício de Paiva
> http://wladistonpaiva.com.br
> desenvolvedo...@gmail.com
> e...@wladistonpaiva.com.br
> +55 (31) 8435 - 5380
>
>
> 2009/9/16 Wladiston Paiva 
>
>  Friend, this table is a new.
>> the strange thing is that cakephp consulting in firebird works fine(1
>> query result), but something happens after the consultation that he loses
>> the password in $this->data.
>>
>> ---
>> Wladiston Maurício de Paiva
>> http://wladistonpaiva.com.br
>> desenvolvedo...@gmail.com
>> e...@wladistonpaiva.com.br
>> +55 (31) 8435 - 5380
>>
>>
>> 2009/9/15 Aivaras 
>>
>> Didn't you migrate to an existing database? Remember that Security::salt
>>> does not only use md5 or sha1 but also a Salt that you've filled in your
>>> core.php
>>>
>>> Faifas
>>> http://www.voveris.eu/
>>>
>>>
>>>
>>> On Tue, Sep 15, 2009 at 22:10, Wladiston Paiva <
>>> desenvolvedo...@gmail.com> wrote:
>>>
>>>> Hi guys!
>>>> I find a problem in auth component.
>>>>
>>>> *User Model:*
>>>> class User extends AppModel {
>>>> var $name = 'User';
>>>> }
>>>>
>>>>
>>>> *Users Controller:*
>>>> class UsersController extends AppController {
>>>> var $name = "Users";
>>>> var $uses = array('User');
>>>> var $components = array('Auth');
>>>>
>>>> function beforeFilter() {
>>>> parent::debugVar($_POST);
>>>> parent::beforeFilter();
>>>> }
>>>>
>>>> function login() {
>>>> //Auth Magic
>>>> parent::debugVar($this->data);
>>>> }
>>>>
>>>> function logout() {
>>>> $this->redirect($this->Auth->logout());
>>>> }
>>>> }
>>>>
>>>>
>>>> *App Controller:*
>>>> class AppController extends Controller {
>>>> var $components = array('Auth');
>>>>
>>>> function beforeFilter() {
>>>> //Security::setHash('md5'); // or sha1 or sha256.
>>>> //Configure AuthComponent
>>>> $this->Auth->loginAction = array('controller' => 'users',
>>>> 'action' => 'login');
>>>> $this->Auth->logoutRedirect = array('controller' => 'users',
>>>> 'action' => 'login');
>>>> $this->Auth->loginRedirect = array('controller' => 'usuarios',
>>>> 'action' => 'add');
>>>> }
>>>> }
>>>>
>>>>
>>>> When I run the debug, the sql is mounted correctly. but it returned the
>>>> error "Login failed. Invalid username or password."
>>>> I take the sql generated and run on the bank, and is returned correctly
>>>> the User.
>>>> If I print the $ _POST values come correctly, if I print the $ this->
>>>> data, the User is correct, but the password is NULL..
>>>>
>>>>
>>>> *POST:*
>>>> array(2) {
>>>> ["_method"]=>
>>>> string(4) "POST"
>>>> ["data"]=>
>>>> array(1) {
>>>> ["User"]=>
>>>> array(2) {
>>>>   ["username"]=>
>>>>   string(5) "admin"
>>>>   ["password"]=>
>>>>   string(6) "123456"
>>>> }
>>>> }
>>>> }
>>>>
>>>>
>>>> *this->data:*
>>>> array(1) {
>>>> ["User"]=>
>>>> array(2) {
>>>> ["username"]=>
>>>> string(5) "admin"
>>>> ["password"]=>
>>>> NULL
>>>> }
>>>> }
>>>>
>>>>
>>>> Does anyone have any idea how to solve this problem?
>>>> Thanks friends!
>>>>
>>>> ---
>>>> Wladiston Maurício de Paiva
>>>> http://wladistonpaiva.com.br
>>>> desenvolvedo...@gmail.com
>>>> e...@wladistonpaiva.com.br
>>>> +55 (31) 8435 - 5380
>>>>
>>>>
>>>>
>>>
>>> >>>
>>>
>>
>

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: "Login failed. Invalid username or password." in Auth Component

2009-09-21 Thread Wladiston Paiva
http://www.cakephpforum.net/index.php?showtopic=1709&st=0&#entry6282

up!

---
Wladiston Maurício de Paiva
http://wladistonpaiva.com.br
desenvolvedo...@gmail.com
e...@wladistonpaiva.com.br
+55 (31) 8435 - 5380


2009/9/16 Wladiston Paiva 

> Friend, this table is a new.
> the strange thing is that cakephp consulting in firebird works fine(1 query
> result), but something happens after the consultation that he loses the
> password in $this->data.
>
> ---
> Wladiston Maurício de Paiva
> http://wladistonpaiva.com.br
> desenvolvedo...@gmail.com
> e...@wladistonpaiva.com.br
> +55 (31) 8435 - 5380
>
>
> 2009/9/15 Aivaras 
>
> Didn't you migrate to an existing database? Remember that Security::salt
>> does not only use md5 or sha1 but also a Salt that you've filled in your
>> core.php
>>
>> Faifas
>> http://www.voveris.eu/
>>
>>
>>
>> On Tue, Sep 15, 2009 at 22:10, Wladiston Paiva > > wrote:
>>
>>> Hi guys!
>>> I find a problem in auth component.
>>>
>>> *User Model:*
>>> class User extends AppModel {
>>> var $name = 'User';
>>> }
>>>
>>>
>>> *Users Controller:*
>>> class UsersController extends AppController {
>>> var $name = "Users";
>>> var $uses = array('User');
>>> var $components = array('Auth');
>>>
>>> function beforeFilter() {
>>> parent::debugVar($_POST);
>>> parent::beforeFilter();
>>> }
>>>
>>> function login() {
>>> //Auth Magic
>>> parent::debugVar($this->data);
>>> }
>>>
>>> function logout() {
>>> $this->redirect($this->Auth->logout());
>>> }
>>> }
>>>
>>>
>>> *App Controller:*
>>> class AppController extends Controller {
>>> var $components = array('Auth');
>>>
>>> function beforeFilter() {
>>> //Security::setHash('md5'); // or sha1 or sha256.
>>> //Configure AuthComponent
>>> $this->Auth->loginAction = array('controller' => 'users',
>>> 'action' => 'login');
>>> $this->Auth->logoutRedirect = array('controller' => 'users',
>>> 'action' => 'login');
>>> $this->Auth->loginRedirect = array('controller' => 'usuarios',
>>> 'action' => 'add');
>>> }
>>> }
>>>
>>>
>>> When I run the debug, the sql is mounted correctly. but it returned the
>>> error "Login failed. Invalid username or password."
>>> I take the sql generated and run on the bank, and is returned correctly
>>> the User.
>>> If I print the $ _POST values come correctly, if I print the $ this->
>>> data, the User is correct, but the password is NULL..
>>>
>>>
>>> *POST:*
>>> array(2) {
>>> ["_method"]=>
>>> string(4) "POST"
>>> ["data"]=>
>>> array(1) {
>>> ["User"]=>
>>> array(2) {
>>>   ["username"]=>
>>>   string(5) "admin"
>>>   ["password"]=>
>>>   string(6) "123456"
>>> }
>>> }
>>> }
>>>
>>>
>>> *this->data:*
>>> array(1) {
>>> ["User"]=>
>>> array(2) {
>>> ["username"]=>
>>> string(5) "admin"
>>> ["password"]=>
>>> NULL
>>> }
>>> }
>>>
>>>
>>> Does anyone have any idea how to solve this problem?
>>> Thanks friends!
>>>
>>> ---
>>> Wladiston Maurício de Paiva
>>> http://wladistonpaiva.com.br
>>> desenvolvedo...@gmail.com
>>> e...@wladistonpaiva.com.br
>>> +55 (31) 8435 - 5380
>>>
>>>
>>>
>>
>> >>
>>
>

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: "Login failed. Invalid username or password." in Auth Component

2009-09-16 Thread Wladiston Paiva
Friend, this table is a new.
the strange thing is that cakephp consulting in firebird works fine(1 query
result), but something happens after the consultation that he loses the
password in $this->data.

---
Wladiston Maurício de Paiva
http://wladistonpaiva.com.br
desenvolvedo...@gmail.com
e...@wladistonpaiva.com.br
+55 (31) 8435 - 5380


2009/9/15 Aivaras 

> Didn't you migrate to an existing database? Remember that Security::salt
> does not only use md5 or sha1 but also a Salt that you've filled in your
> core.php
>
> Faifas
> http://www.voveris.eu/
>
>
>
> On Tue, Sep 15, 2009 at 22:10, Wladiston Paiva 
> wrote:
>
>> Hi guys!
>> I find a problem in auth component.
>>
>> *User Model:*
>> class User extends AppModel {
>> var $name = 'User';
>> }
>>
>>
>> *Users Controller:*
>> class UsersController extends AppController {
>> var $name = "Users";
>> var $uses = array('User');
>> var $components = array('Auth');
>>
>> function beforeFilter() {
>> parent::debugVar($_POST);
>> parent::beforeFilter();
>> }
>>
>> function login() {
>> //Auth Magic
>> parent::debugVar($this->data);
>> }
>>
>> function logout() {
>> $this->redirect($this->Auth->logout());
>> }
>> }
>>
>>
>> *App Controller:*
>> class AppController extends Controller {
>> var $components = array('Auth');
>>
>> function beforeFilter() {
>> //Security::setHash('md5'); // or sha1 or sha256.
>> //Configure AuthComponent
>> $this->Auth->loginAction = array('controller' => 'users', 'action'
>> => 'login');
>> $this->Auth->logoutRedirect = array('controller' => 'users',
>> 'action' => 'login');
>> $this->Auth->loginRedirect = array('controller' => 'usuarios',
>> 'action' => 'add');
>> }
>> }
>>
>>
>> When I run the debug, the sql is mounted correctly. but it returned the
>> error "Login failed. Invalid username or password."
>> I take the sql generated and run on the bank, and is returned correctly
>> the User.
>> If I print the $ _POST values come correctly, if I print the $ this->
>> data, the User is correct, but the password is NULL..
>>
>>
>> *POST:*
>> array(2) {
>> ["_method"]=>
>> string(4) "POST"
>> ["data"]=>
>> array(1) {
>> ["User"]=>
>> array(2) {
>>   ["username"]=>
>>   string(5) "admin"
>>   ["password"]=>
>>   string(6) "123456"
>> }
>> }
>> }
>>
>>
>> *this->data:*
>> array(1) {
>> ["User"]=>
>> array(2) {
>> ["username"]=>
>> string(5) "admin"
>> ["password"]=>
>> NULL
>> }
>> }
>>
>>
>> Does anyone have any idea how to solve this problem?
>> Thanks friends!
>>
>> ---
>> Wladiston Maurício de Paiva
>> http://wladistonpaiva.com.br
>> desenvolvedo...@gmail.com
>> e...@wladistonpaiva.com.br
>> +55 (31) 8435 - 5380
>>
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: "Login failed. Invalid username or password." in Auth Component

2009-09-15 Thread Aivaras
Didn't you migrate to an existing database? Remember that Security::salt
does not only use md5 or sha1 but also a Salt that you've filled in your
core.php

Faifas
http://www.voveris.eu/


On Tue, Sep 15, 2009 at 22:10, Wladiston Paiva wrote:

> Hi guys!
> I find a problem in auth component.
>
> *User Model:*
> class User extends AppModel {
> var $name = 'User';
> }
>
>
> *Users Controller:*
> class UsersController extends AppController {
> var $name = "Users";
> var $uses = array('User');
> var $components = array('Auth');
>
> function beforeFilter() {
> parent::debugVar($_POST);
> parent::beforeFilter();
> }
>
> function login() {
> //Auth Magic
> parent::debugVar($this->data);
> }
>
> function logout() {
> $this->redirect($this->Auth->logout());
> }
> }
>
>
> *App Controller:*
> class AppController extends Controller {
> var $components = array('Auth');
>
> function beforeFilter() {
> //Security::setHash('md5'); // or sha1 or sha256.
> //Configure AuthComponent
> $this->Auth->loginAction = array('controller' => 'users', 'action'
> => 'login');
> $this->Auth->logoutRedirect = array('controller' => 'users',
> 'action' => 'login');
> $this->Auth->loginRedirect = array('controller' => 'usuarios',
> 'action' => 'add');
> }
> }
>
>
> When I run the debug, the sql is mounted correctly. but it returned the
> error "Login failed. Invalid username or password."
> I take the sql generated and run on the bank, and is returned correctly the
> User.
> If I print the $ _POST values come correctly, if I print the $ this-> data,
> the User is correct, but the password is NULL..
>
>
> *POST:*
> array(2) {
> ["_method"]=>
> string(4) "POST"
> ["data"]=>
> array(1) {
> ["User"]=>
> array(2) {
>   ["username"]=>
>   string(5) "admin"
>   ["password"]=>
>   string(6) "123456"
> }
> }
> }
>
>
> *this->data:*
> array(1) {
> ["User"]=>
> array(2) {
> ["username"]=>
> string(5) "admin"
> ["password"]=>
> NULL
> }
> }
>
>
> Does anyone have any idea how to solve this problem?
> Thanks friends!
>
> ---
> Wladiston Maurício de Paiva
> http://wladistonpaiva.com.br
> desenvolvedo...@gmail.com
> e...@wladistonpaiva.com.br
> +55 (31) 8435 - 5380
>
> >
>

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



"Login failed. Invalid username or password." in Auth Component

2009-09-15 Thread Wladiston Paiva
Hi guys!
I find a problem in auth component.

*User Model:*
class User extends AppModel {
var $name = 'User';
}


*Users Controller:*
class UsersController extends AppController {
var $name = "Users";
var $uses = array('User');
var $components = array('Auth');

function beforeFilter() {
parent::debugVar($_POST);
parent::beforeFilter();
}

function login() {
//Auth Magic
parent::debugVar($this->data);
}

function logout() {
$this->redirect($this->Auth->logout());
}
}


*App Controller:*
class AppController extends Controller {
var $components = array('Auth');

function beforeFilter() {
//Security::setHash('md5'); // or sha1 or sha256.
//Configure AuthComponent
$this->Auth->loginAction = array('controller' => 'users', 'action'
=> 'login');
$this->Auth->logoutRedirect = array('controller' => 'users',
'action' => 'login');
$this->Auth->loginRedirect = array('controller' => 'usuarios',
'action' => 'add');
}
}


When I run the debug, the sql is mounted correctly. but it returned the
error "Login failed. Invalid username or password."
I take the sql generated and run on the bank, and is returned correctly the
User.
If I print the $ _POST values come correctly, if I print the $ this-> data,
the User is correct, but the password is NULL..


*POST:*
array(2) {
["_method"]=>
string(4) "POST"
["data"]=>
array(1) {
["User"]=>
array(2) {
  ["username"]=>
  string(5) "admin"
  ["password"]=>
  string(6) "123456"
}
}
}


*this->data:*
array(1) {
["User"]=>
array(2) {
["username"]=>
string(5) "admin"
["password"]=>
NULL
}
}


Does anyone have any idea how to solve this problem?
Thanks friends!

---
Wladiston Maurício de Paiva
http://wladistonpaiva.com.br
desenvolvedo...@gmail.com
e...@wladistonpaiva.com.br
+55 (31) 8435 - 5380

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using the Auth component when creating Plugins

2009-09-15 Thread Bart

I've found the solution.
In the beforeFilter() instead of putting this:
$this->Auth->loginAction = array
('controller'=>'users','action'=>'login');

Put the following:
$this->Auth->loginAction = array
('plugin'=>'users','controller'=>'users','action'=>'login');

On 12 sep, 23:35, Bart  wrote:
> Hello,
>
> I'm creating apluginto act as a Blog.
> The main controller has the same name as theplugin(app/plugins/blog/
> controllers/blog_controller.php)
> I'm trying to use theAuthcomponent with thisplugin. However, when a
> user is not logged in, the component redirects me to the following
> address:
> "http://example.com/blog/users/login"; instead of "http://example.com/
> users/login"
>
> How could I solve this?
>
> Thanks,
> Bart
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Using the Auth component when creating Plugins

2009-09-12 Thread Bart

Hello,

I'm creating a plugin to act as a Blog.
The main controller has the same name as the plugin (app/plugins/blog/
controllers/blog_controller.php)
I'm trying to use the Auth component with this plugin. However, when a
user is not logged in, the component redirects me to the following
address:
"http://example.com/blog/users/login"; instead of "http://example.com/
users/login"

How could I solve this?



Thanks,
Bart

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Registration using auth component

2009-09-04 Thread WebbedIT

You need to specify $this->Auth->allow('register'); in the beforeFilter
() of your users_controller.php

Read about the Auth components methods for more info.
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Registration using auth component

2009-09-04 Thread hemant

I want use auth component for new registration. it always ask me to
login first and then prompt for registration

can any one guide me how to use auth for registraion and login process


--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Questions regarding Auth component/login box as an element

2009-09-02 Thread Christian

Hello,

I am trying to check out different php frameworks. As a first test I
want to create a login box that should appear on every page of the
website (that has the standard layout). If a user is not logged in,
the login form should appear. If he is logged in, an appropriate
message and a logout link or button should appear.

I baked the Users model and controller, that worked fine.

The I created an element "loginbox" that I refer to in my default.ctp
by "echo $this->element('loginbox');". For a start, loginbox.ctp
simply created a login form.

The password field in the database table is hashed with md5, so in the
app_controller.php's beforeFIlter I execute "Security::setHash
('md5');".

I work on the very same database and table with a similar Zend test
project, and login works fine there.

But in CakePHP I have problems. First: I am not logged in. Instead I
land on a page with a login box in the main content area (plus of
course the login box that I constructed myself as an element).

In the users_controller.php's beforeFilter I placed:
$this->Auth->loginError = 'Invalid e-mail / password combination.
Please try again';

But this error appears nowhere (although I places "$session->flash
('auth');" in loginbox.ctp)

For testing purposes I places "$this->Auth->autoRedirect = false;" in
the users_controller.php's beforeFilter and then placed code in the
login function of that controller (from here:
http://www.littlehart.net/atthekeyboard/2007/09/11/a-hopefully-useful-tutorial-for-using-cakephps-auth-component/)

I modified that code a little to redirect to http://www.yahoo.de when
the login failed. That worked. So at least I think that the controller
is used at all.

But then the question is: Why does the login not work? I modified the
security's hashing algorithm to MD5, so it should work.

The other question is: how could I access the Auth component from a
layout or an element? The loginbox.ctp should only show the login form
if the user is not logged in. So I need an conditional clause in the
loginbox.ctp and need to determine whether the user is logged in or
not. Or alternatively I need a loginbox.ctp and a logoutbox.ctp and
then in the default.ctp I place an conditional clause that either
places the loginbox or the logoutbox in the header section.

A third question: As I mentioned above, if I keep the autoRedirect
switched on and the login fails, a login form is displayed in the main
area. Though this can be a wanted behavior for some websites, just out
of curiosity: How would it be done to keep the user on the actual page
and let the loginbox handle the display of the error? I found this as
a description of how to store the referrer into a session (http://
bin.cakephp.org/view/316159681). But then how would I tell the
users_controller.php to jump to the actual page in case of a failed
login attempt? Does it have to be done by switching of autoRedirect
and doing it by myself in the login function?

Any help or a hint would be very appreciated.

Christian

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



<    1   2   3   4   5   6   7   8   9   >