I had things a bit backwards. Username and Password fields are in fact
present in the array when the form submits to the add action (however the
password was plain text and not hashed when saved). The problem I was
encountering is pulling the data from the fields before the form is even
submitted. With fields named as "User.password" and "User.username"
$ajax->observeField completely disregarded those fields as if they weren't
even there. I took another approach with
JS Form.Element.getValue('UserPassword'); and that also returned an empty
value for both fields. Upon renaming the fields to anything other than
Username and Password I was able to extract the values from those fields. It
may have been a bit presumptuous of me to immediately point the finger at
Cake/Auth but upon a little digging it seemed to make the most sense at the
time. Ultimately I ended up extracting the values with JS and passing them
into the controller action to do what I needed. I added the User.username
and User.password to the form as hidden fields and used "beforeSave()" to
set their values to that of the renamed fields.Don't get me wrong, within my first half hour of experimenting with Cake I could see huge potential and how it could dramatically help. I was more than excited to dive in. My questioning if Cake is worth it comes mainly from ignorance and frustration. If you do something the same way for a long enough time you become so accustomed to the process that it becomes second nature and any type of problems that take more than 5 minutes to work out are almost non-existent. I suppose there are moments when I think it's easier and faster to just go with what you know and write the code yourself rather than spending the day trying to figure out what's wrong this time ;). If I really felt that Cake wasn't worth the time I would have abandoned it by now. Also, the best functions library doesn't hold up at all to a good framework. 90% of all those functions become obsolete with Cake. However with a good framework behind the other 10% I could foresee making some extremely functional and dare I say 'powerful' apps. Anyhow, I still don't know why I couldn't access the values in those fields. I hate to move on just because I got it to work, I'd like to know why it didn't work. - Ed On Sun, Mar 28, 2010 at 4:15 AM, WebbedIT <[email protected]> wrote: > Can you explain why you believe Cake/Auth is removing Username and > Password? Can you boil this down to a very simple code example where > a non ajax form submits all fields and your ajax form submits all > fields minus the username and password? > > I have designed many sites with Cake and never had such issues > including using jQuery/AJAX to validate a form field by field > including username and password (although you can't use the field > password as Cake automatically hashes it - but that's no biggy). > > As for your argument that for an experienced developer who is very > confident with PHP, MySQL, Flex etc, maybe using a framework is not > the best option for you if you already have your own library of > code ... it's a personal choice. > > For me who had taught myself PHP and a lot of bad habits CakePHP has > been a steep learning curve that was well worth it. My coding now > follows the MVC design pattern and is so much more efficient and > maintainable. Other developers could instantly step into my shoes and > support/develop my code. > > Don;t know if anyone can answer which of the many benefits cake > offer's would suit you, you must have started looking at frameworks > for a reason so your best placed to know if a framework has made your > life any better. Personally if I were you I would stick with it till > you become more familiar with all of the features as I am yet to see > one person in the community come out and say I have given Cake a good > go and I'm going back to my own PHP and there are a lot of developers > in the community. > > Those who do slate Cake tend to be favouring another framework from > what I have seen. > > 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 [email protected] > To unsubscribe from this group, send email to > [email protected]<cake-php%[email protected]>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. > 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 [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 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.
