Hi Anja,

> Thank you for your continuing help! Now I have (thanks to you) the correct 
> password in my db and don't get the message anymore about the wrong login 
> information.

You are welcome, I'm glad to be of help.

> However: I still cannot access my application. What happenes now is (debug 
> level set to 2)
>
> I load my login screen ( a lot of DESCRIBE queries are shown in the debug 
> output), type in the correct login information and press on "send".
> Nothing happens, no queries take place, I see my login form and no error 
> message.
>
> So I had a view at the $_SESSION variable after the login:
>
>    [Auth] => Array
>        (
>            [User] => Array
>                (
>                    [id] => 1
>                    [name] => Anja Liebermann
>                    [username] => liebermann
>                    [deleted] => 0
>                    [gruppe_id] => 2
>                )
>
>            [redirect] => /users/login
>        )

>From your session dump, it seems that you will be redirected to
/users/login when you complete the login, so it seems an Auth
configuration problem. If you don't want the auteredirect feature, you
can disable it ( $this->Auth->autoRedirect = false ) and use a login
action like this:

        function login() {
                if (!empty($this->data) && $this->Auth->user()) {

$this->User->updateLoginTimestamp($this->Auth->user('id')); // this is
specific for my app
                        $this->redirect($this->Auth->redirect()); //
you can use a hardcoded url here
                }
        }

Anyway, I think you should look at your setup because AuthComponent
works well out of the box ;)

A thing that is easy to forget is the fact that all requested actions
will also go through Auth, so they must be allowed for the user.

I suggest you to read the manual chapter on auth and the good
tutorials of Chris Hartjes,
http://www.littlehart.net/atthekeyboard/2007/09/11/a-hopefully-useful-tutorial-for-using-cakephps-auth-component/

> When I click on my "logout" link I get the "Good-Bye" message, and my user 
> data is removed from the $_SESSION.
>
> So it seems that my application could retrieve my user information, but why 
> am I not redirected to the specified controller?
>
> My login function looks like this:
>        function login() {
>                $this->layout = 'login';
>                //Auth Magic
>        }
> In my app controller I have the following lines:
>
> class AppController extends Controller {
>
>        var $components = array('Auth', 'Acl');
>
>        function beforeFilter() {
>                //Configure AuthComponent
>                $this->Auth->authorize = 'actions';
>                $this->Auth->loginRedirect = array('controller' => 'hotels', 
> 'action' => 'index');
>                $this->Auth->allowedActions = array('display');
>        }
> }


That seems right...

HTH,
- Dardo.

> Thank you in advance for any hints!
>
> Anja
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: [email protected] [mailto:[EMAIL PROTECTED] Im Auftrag von Dardo 
> Sordi Bogado
> Gesendet: Montag, 17. November 2008 21:26
> An: [email protected]
> Betreff: Re: Acl + Auth and now all I see is a blank page
>
>
> Auth hashes passwords with SHA1( password + salt ).
>
> The easiest way is to enable debug level 2, then type your password in the 
> login form and hit submit. Look for the correct hash in the sql log and then 
> update your password in db and you are done.
>
> HTH,
> - Dardo.
>
> On Mon, Nov 17, 2008 at 1:43 PM, Liebermann, Anja Carolin <[EMAIL PROTECTED]> 
> wrote:
>>
>> Thank you Dardo!
>>
>> So I started again from the beginning with my real aplication.
>> I can finally see my login screen, but get the error message:
>> "Login failed. Invalid username or password."
>>
>> What I already did:
>> * encrypted my password in the database with sha1 instead of md5, which was 
>> my method of choice before.
>> * the password field in the db is varchar(40) and like my whole
>> appilcation utf8_unicode_ci
>> * my user is in the admin group
>> * also in the aro table my user has the admin group as parent_id
>> * the only entry in my aros_acos table specifies that admins are allowed to 
>> see every action in all controllers
>> * the login      uses its own layout:
>>        function login() {
>>                $this->layout = 'login';
>>                //Auth Magic
>>        }
>>
>> Anyone an idea, why I cannot login?
>>
>> Thank you very much!
>>
>> Anja
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: [email protected] [mailto:[EMAIL PROTECTED] Im
>> Auftrag von Dardo Sordi Bogado
>> Gesendet: Montag, 17. November 2008 12:52
>> An: [email protected]
>> Betreff: Re: Acl + Auth and now all I see is a blank page
>>
>>
>> Don't add login to the list of allowed actions, never.
>>
>> book.cakephp.org
>>
>> 5.2.5.2 allow
>> If you have some actions in your controller that you don't have to 
>> authenticate against (such as a user registration action), you can add 
>> methods that the AuthComponent should ignore. The following example shows 
>> how to allow an action named 'register'.
>>
>>        Do not specifically allow 'login' because that will break Auth.
>>
>>
>> HTH,
>> - Dardo.
>>
>> On Mon, Nov 17, 2008 at 8:58 AM, Liebermann, Anja Carolin <[EMAIL 
>> PROTECTED]> wrote:
>>>
>>> Hi Mark,
>>>
>>> I followed Dardos advice and did everything first in a small test 
>>> application, learned something and hurray... There it worked, even when I 
>>> renamed "Group" to the German "Gruppe".
>>> Now I start my second approach with my real application but I first
>>> got the mesage from auth, that my login is invalid. Then I set in the
>>> users_controller.php
>>>
>>>        function beforeFilter() {
>>>                parent::beforeFilter();
>>>                $this->Auth->allowedActions = array('*');
>>>        }
>>> or
>>>        function beforeFilter() {
>>>                parent::beforeFilter();
>>>                $this->Auth->allowedActions = array('login');
>>>        }
>>> Now I get the blank page even with debug level set to 3.
>>>
>>> I thought maybe I have messed up my permissions and deleted all of the db 
>>> entries in aros_acos except the one which allows the admins access to 
>>> everything, but that makes no difference either.
>>>
>>> What I did different from the tutorial is, that I didn't allow index and 
>>> view, because in my application only the login or static pages are allowed 
>>> without logging in.
>>>
>>> Any idea what went wrong?
>>>
>>> Thank you in advance
>>>
>>> Anja
>>>
>>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: [email protected] [mailto:[EMAIL PROTECTED] Im
>>> Auftrag von mark_story
>>> Gesendet: Donnerstag, 13. November 2008 15:14
>>> An: CakePHP
>>> Betreff: Re: Acl + Auth and now all I see is a blank page
>>>
>>>
>>> If you are getting a 'blank' as in white screen, probably a parse or other 
>>> fatal error.  Turn on debug to 2 to see the errors.
>>>
>>> -Mark
>>>
>>> On Nov 12, 10:40 am, "Liebermann, Anja Carolin"
>>> <[EMAIL PROTECTED]> wrote:
>>>> Hello everybody,
>>>>
>>>> I followed this
>>>> tutorialhttp://manual.cakephp.org/view/641/Simple-Acl-controlled-App
>>>> l
>>>> i
>>>> cation
>>>>
>>>> And tried to adapt it for my application (which isn't simple at all
>>>> anymore: about 70 controllers). After doing everything, I cannot sse
>>>> my login page. It is just a completely blank page although I have
>>>> put in my users_controller.php
>>>>
>>>>         function beforeFilter()
>>>>         {
>>>>                 parent::beforeFilter();
>>>>                 $this->Auth->allowedActions = array('*');
>>>>         }
>>>>
>>>> The same in my groups controller.
>>>>
>>>> In my app_controller.php  I have:
>>>> function beforeFilter() {
>>>>     //Configure AuthComponent
>>>>     $this->Auth->authorize = 'actions';
>>>>     $this->Auth->allowedActions = array('display');
>>>>     $this->Auth->loginAction = array('controller' => 'users', 'action'
>>>> => 'login');
>>>>     $this->Auth->logoutRedirect = array('controller' => 'users',
>>>> 'action' => 'login');
>>>>     $this->Auth->loginRedirect = array('controller' => 'hotels',
>>>> 'action' => 'index');
>>>>
>>>> }
>>>>
>>>> The file app_controller is placed in the app/ folder on the same
>>>> level like the model and controller folder.
>>>>
>>>> Any idea what went wrong?
>>>>
>>>> Group is Gruppe in German and I adapted the code, models,
>>>> controllers accordingly. Or do groups have to be named groups, like
>>>> the loginname has to be username?
>>>>
>>>> Thank you in advance!
>>>>
>>>> Anja
>>>
>>>
>>> >
>>>
>>
>>
>>
>> >
>>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to