Recents Comments for post: Auth module for Kohana 3.1 using ORM Driver Sat, 26 Mar 2011 00:00:00 CDT Comments for post: Auth module for Kohana 3.1 using ORM Driver http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver KohanaPHP New comment by Mondongo http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Thanks for doing this!<br /> <br /> Just got your book in Kindle edition, it's what I was looking for! Thu, 08 Mar 2012 07:56:36 CST New comment by Arthur http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Thank you very much, for this article! Best Auth guide for kohana. Mon, 19 Sep 2011 23:08:56 CDT New comment by Zetell http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Thank you very much for this guide! It helped me upgade my Kohana-based project from 3.0.x branch to 3.1. Sun, 28 Aug 2011 07:38:49 CDT New comment by Sune http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Hello Straughan and other readers.<br /> <br /> Nice blog you have here.<br /> <br /> I am new to Kohana and followed your tutorial to create the login functionality.<br /> <br /> However I can not figure out how to change the password requirements other than changing /modules/orm/classes/model/auth/user.php<br /> <br /> Do I really have to change this file? I find that the Kohana style is overriding the default behavior with custom behavior, so I would find it odd having to change the ORM module files directly.<br /> <br /> Thanks. Wed, 24 Aug 2011 15:17:52 CDT New comment by skyman http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Great article man!<br /> <br /> P.s. You should mention about Cookie::$salt beacuse it's important too :) Tue, 05 Jul 2011 08:59:24 CDT New comment by Alex http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Great example! Thanks alot! Mon, 27 Jun 2011 07:39:34 CDT New comment by youngpac http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments thanks JDStraughan i saw ma mistake and rectified it.. your tutorial has gone a long way in helping me understand! Sat, 25 Jun 2011 06:09:50 CDT New comment by Ryan http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Finally someone explains this stuff in a clear and concise manner. I was pulling hair I don't even have out! Works like a charm now. I look forward to the book, how about you send me an email when it comes out? ;) Wed, 22 Jun 2011 23:12:57 CDT New comment by Yann http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Yep, it's works great.<br /> <br /> I actually made a lots of changes into that but override some function like the _login() one.<br /> And i was able to add an activation email instead of adding the login role directly.<br /> <br /> Just one info if someone need, if you want to load your module extending the Auth module, you have to load it in the bootstrap.php BEFORE the Auth module ! (take me a few hours to understand my mistake was there lol)<br /> <br /> Thanks for all JDStraughan, can't wait to see your book ! Sat, 11 Jun 2011 19:19:43 CDT New comment by JDStraughan http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments @youngpac, @Yann: You can add to the user table and model, extend the model, or add to the controller. I am not really sure what you need.<br /> <br /> @Yann: I made the change, thanks for pointing that out!<br /> <br /> @Peter: Glad to see you making good use of the tutorial! Fri, 10 Jun 2011 17:17:12 CDT New comment by Peter Weil http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Thanks also for the examples using the Arr helper methods. I never realized how useful these are.<br /> <br /> If you want to display all of the errors together; e.g., above the form, you can run a check on $errors['_external']['password'] and add it to the $errors array.<br /> <br /> if ( ! empty($errors['_external']['password']))<br /> {<br /> $errors[] = $errors['_external']['password'];<br /> }<br /> <br /> And then just loop through $errors to display them, e.g.,<br /> <br /> if( ! empty($errors)) : ?> Fri, 10 Jun 2011 12:15:33 CDT New comment by youngpac http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments hi, am trying to move the code from the use class to my index controller so that the auth can check on login on to the website but whnever i hit the submit button it takes me to user/login while i have remove the class for user any help?<br /> <br /> thanks in advance. Fri, 10 Jun 2011 01:17:39 CDT New comment by Yann http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Hi again, <br /> <br /> I saw something wrong in a sentence you made "To provide a custom message for that also, you will need to create a new directory named user inside messages/user, and add a file named _external.php"<br /> <br /> Your _external.php file must be in messages/models/user/ because you choose to use "models" and not in messages/user/ like you wrote. I think you made a typo.<br /> <br /> Hope this help some others ^^<br /> <br /> Yann Thu, 09 Jun 2011 19:41:59 CDT New comment by Yann http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Hi !<br /> <br /> Thanks for this post, help me a lot. <br /> <br /> I'm trying to extends a lot user class of Auth and creating some new ones for adding capabilities like Wordpress ones. But like Cesar, I'm a little lost so can you help me understand how to extends or create new class who can interact with the Auth class ?! <br /> <br /> Thank you very much in advance,<br /> <br /> Yann Thu, 09 Jun 2011 16:56:00 CDT New comment by JDStraughan http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments @Brian, Lee: Sorry for the late reply. I have fixed the password error message, and now show how to properly override and retrieve the error message for this field. <br /> <br /> You may want to look at the Arr::path() method as well as Arr::get(), and do note I have included both in the above examples.<br /> <br /> @Cesar: I hope you got my email and I hope it answered your questions. I may do a post on ORM relationships in the near future.<br /> <br /> @All: Thanks for the kind words, and please continue to ask questions and point out my bugs ;) Tue, 07 Jun 2011 23:11:08 CDT New comment by youngpac http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments thanks a bunch for this <br /> its one of the best tutorials i have seen yet... Tue, 07 Jun 2011 12:48:32 CDT New comment by Peter Weil http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Please ignore my last message. The problem was that I had to set a custom read/write-privileged MySQL config to *all* of the models being used by auth, and not just the User model. Sorry to bug you, and thanks again for this tutorial. Kohana is a wonderful framework, but sometimes the lack of good, up-to-date "how-tos" drives me up a wall. Tue, 07 Jun 2011 10:23:53 CDT New comment by Peter Weil http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Thank you *so much* for this, Jason - this sort of thing is so badly needed. Perhaps I messed something up, but after I successfully created a new user, I cannot log in (and there is no error message). It just keeps returning me to the login page. However, the log says "ERROR: Error reading session data: " Do you have any ideas as to what's wrong?<br /> <br /> (looking forward to your Kohana book!) Tue, 07 Jun 2011 09:39:46 CDT New comment by Fredrik http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Fantastic! I'm definitely buying your book once its published :c) Mon, 06 Jun 2011 06:31:51 CDT New comment by Brian Wisti http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Well you're my new favorite Kohana blogger ^_^ This is the first auth tutorial I've come across that actually lets me create user and log in and out as the user with 3.1. Thanks very much!<br /> <br /> I did come across the same issues that Lee mentioned, though. Both `password` and `password_confirm` were stored in `_external`. `_external` error messages had to be accessed via `Arr::get($errors['_external'], $field)`. Also, the message overrides in `application/messages/user/_external.php` didn't appear to take. It used the default messages for those.<br /> <br /> Mind you, I am _not_ complaining. After struggling a day or so with other resources, yours got me a new user within 30 minutes. Thanks again! Wed, 01 Jun 2011 14:29:17 CDT New comment by Cesar Gonzalez http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Hey Jason, thank you for sharing this and for the thoroughly written tutorial! I was able to get it working without any problems.<br /> <br /> Now I need to extend the user to include some personal information (first / last name, short bio) and some account information ( # of credits). I'm at a loss for how / where I would do this. Do I create another database table and model? Do I extend the existing model and add a few fields to the users table? In each case, where exactly are the relevant files I should work on?<br /> <br /> I know my way around PHP / MySQL but I'm new to Kohana and ORM. I'm hoping that you can point me in the right direction and give me some idea of where to start tackling this? Thanks again! Mon, 30 May 2011 01:38:40 CDT New comment by JDStraughan http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments @Alonso: I cannot reproduce this locally, are you sure you have the framework setup correctly? You are welcome to contact me directly using the contact form, and I will be happy to help in any way I can.<br /> <br /> Thanks! Thu, 12 May 2011 12:25:31 CDT New comment by Alonso http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Hi, it's been quite difficult migrate to 3.1<br /> <br /> I tried this example but i can't login and want to create a new user have this message: <br /> <br /> ---<br /> ORM_Validation_Exception [ 0 ]: Failed to validate array<br /> --<br /> MODPATH/orm/classes/kohana/orm.php [ 1233 ]<br /> <br /> thanks for sharing this, greetings! Thu, 12 May 2011 10:21:12 CDT New comment by Adam http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Great Article! and thanks for the Rick Roll on line 7 of auth.php Got a good laugh out of that. Mon, 09 May 2011 15:46:51 CDT New comment by Lee http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Not sure if previous comment made it through.<br /> <br /> In the registration action, if you enter too-short of a password, there is no error displayed... I can access it in '_external', like this: <br /> <br /> Arr::get($errors['_external'], 'password');<br /> <br /> But I'm unclear if that's an acceptable Kohana way of doing it. Sun, 03 Apr 2011 08:18:34 CDT New comment by Lee http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments Thanks for the guide... One issue: At least some of the error comments don't show up on the template. <br /> <br /> For example, if the user enters too short of a password... I can access that using the following: <br /> <br /> <br /> <br /> But I'm unsure of Kohana's message routing and don't know if that's the correct way to handle it. Sun, 03 Apr 2011 08:10:41 CDT New comment by JDStraughan http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments @david: Thanks! I have made the correction. Sat, 02 Apr 2011 06:58:18 CDT New comment by david http://jdstraughan.com/post/auth-module-for-kohana-31-using-orm-driver#comments You made a little mistake. array_key_exists already returns a boolean so there is no need for a ternary operator.<br /> <br /> Otherwise a great article! Sat, 02 Apr 2011 06:41:38 CDT