<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Zendcasts Forum - ZC44 – Logging in Users using Doctrine and Zend_Auth]]></title>
	<link rel="self" href="http://www.zendcasts.com/forum/feed/atom/topic/130/"/>
	<updated>2010-04-05T07:26:41Z</updated>
	<generator>PunBB</generator>
	<id>http://www.zendcasts.com/forum/topic/130/zc44-logging-in-users-using-doctrine-and-zendauth/</id>
		<entry>
			<title type="html"><![CDATA[Re: ZC44 – Logging in Users using Doctrine and Zend_Auth]]></title>
			<link rel="alternate" href="http://www.zendcasts.com/forum/post/775/#p775"/>
			<content type="html"><![CDATA[<p>Hi Jon, I want ask about OOP, I&#039;m still not strong in OOP <img src="http://www.zendcasts.com/forum/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /></p><p>Are function in Model Doctrine must static function?</p><p>If we already use doctrine model,&nbsp; are we necessary use a service layer to insert 2 table/model?</p>]]></content>
			<author>
				<name><![CDATA[akongz]]></name>
				<uri>http://www.zendcasts.com/forum/user/142/</uri>
			</author>
			<updated>2010-04-05T07:26:41Z</updated>
			<id>http://www.zendcasts.com/forum/post/775/#p775</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: ZC44 – Logging in Users using Doctrine and Zend_Auth]]></title>
			<link rel="alternate" href="http://www.zendcasts.com/forum/post/772/#p772"/>
			<content type="html"><![CDATA[<p>Great podcast Jon - fantastic for a new Zend user like myself.</p><p>However, after completing the stages in this episode I seem to be getting an autoloader issue trying to find the Model classes. Maybe you can help me resolve it.</p><p>My doctrine application.ini section looks like:<br />doctrine.generate_models_options.pearStyle = true<br />doctrine.generate_models_options.generateTableClasses = false<br />doctrine.generate_models_options.generateBaseClasses = true<br />doctrine.generate_models_options.baseClassPrefix = &quot;Base_&quot;<br />doctrine.generate_models_options.classPrefixFiles = false<br />doctrine.generate_models_options.classPrefix = &quot;Model_&quot;<br />doctrine.generate_models_options.baseClassesDirectory = </p><p>Which generates the Models folder structure:<br />application/models/Base/User.php<br />application/models/User.php</p><p>Both classes have the prefix: Model_User &amp; Model_Base_User</p><p>When I come to login to the page (do the postback) I get the following exception:<br />Fatal error: Class &#039;Model_User&#039; not found in /usr/local/zend/apache2/htdocs/Project/library/FME/Auth/Adapter.php on line 23</p><p>The Adapter.php class being the one you wrote in the episode that is dependent on Model_User.</p><p>The classloader cannot find the class/file. I have modified the doctrine config trying many permutations trying to fix this but it does not resolve the Zend issue, and just results in Doctrine CLI throwinf the following:</p><p>build-all-reload - Are you sure you wish to drop your databases? (y/n)<br />y<br />build-all-reload - Successfully dropped database for connection named &#039;doctrine&#039;<br />build-all-reload - Generated models successfully from YAML schema<br />build-all-reload - Successfully created database for connection named &#039;doctrine&#039;<br />build-all-reload - Created tables successfully<br />SQLSTATE[42S02]: Base table or view not found: 1146 Table &#039;fme.user&#039; doesn&#039;t exist. Failing Query: &quot;DELETE FROM user&quot;</p><p>If I set:<br />doctrine.generate_models_options.pearStyle = false (instead of true)</p><p>then the Doctrine CLI works fine and puts the user data into the table correctly - however Zend still complains about the class missing.</p><p>Thanks for any pointers you can give me to fix this,</p>]]></content>
			<author>
				<name><![CDATA[digitalbanana]]></name>
				<uri>http://www.zendcasts.com/forum/user/183/</uri>
			</author>
			<updated>2010-04-02T21:40:45Z</updated>
			<id>http://www.zendcasts.com/forum/post/772/#p772</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: ZC44 – Logging in Users using Doctrine and Zend_Auth]]></title>
			<link rel="alternate" href="http://www.zendcasts.com/forum/post/693/#p693"/>
			<content type="html"><![CDATA[<p>nope, only the base classes</p>]]></content>
			<author>
				<name><![CDATA[Jon Lebensold]]></name>
				<uri>http://www.zendcasts.com/forum/user/3/</uri>
			</author>
			<updated>2010-03-01T03:09:01Z</updated>
			<id>http://www.zendcasts.com/forum/post/693/#p693</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: ZC44 – Logging in Users using Doctrine and Zend_Auth]]></title>
			<link rel="alternate" href="http://www.zendcasts.com/forum/post/691/#p691"/>
			<content type="html"><![CDATA[<p>What exactly does the build all reload do?<br />Does it not overwrite your authenticate method?</p>]]></content>
			<author>
				<name><![CDATA[chielsen]]></name>
				<uri>http://www.zendcasts.com/forum/user/162/</uri>
			</author>
			<updated>2010-02-28T21:15:55Z</updated>
			<id>http://www.zendcasts.com/forum/post/691/#p691</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: ZC44 – Logging in Users using Doctrine and Zend_Auth]]></title>
			<link rel="alternate" href="http://www.zendcasts.com/forum/post/605/#p605"/>
			<content type="html"><![CDATA[<p>Hi Reen,</p><p>I definitely see your point about the Model. Personally, I would rather keep my Doctrine queries outside of any non-Model_* classes, however you do a good point for keeping them in the adapter.</p><p>Good point about Captcha functionality! I guess it really depends on the kind of application.</p>]]></content>
			<author>
				<name><![CDATA[Jon Lebensold]]></name>
				<uri>http://www.zendcasts.com/forum/user/3/</uri>
			</author>
			<updated>2010-02-03T13:59:05Z</updated>
			<id>http://www.zendcasts.com/forum/post/605/#p605</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: ZC44 – Logging in Users using Doctrine and Zend_Auth]]></title>
			<link rel="alternate" href="http://www.zendcasts.com/forum/post/604/#p604"/>
			<content type="html"><![CDATA[<p>Hi again,</p><p>First of all, I do understand that you have to make choices in your video and that you can&#039;t cover all.</p><div class="quotebox"><blockquote><p>The user is not authenticating himself, the use Model, however is.</p></blockquote></div><p>From my point of view it is like you&#039;re saying &quot;It&#039;s ok to let the car controll the traffic light as long as you make the functions static.&quot; I think the Auth_Adapter is an adapter because it only works for certain situations. Like the MySQL DB adapter only works for MySQL. There is no point in making it so abstract that it works in every case, because it will only move your problem to another place.</p><div class="quotebox"><blockquote><p>Furthermore, having multiple exceptions and then explaining their use would blur the overall focus of the video, which is the Zend_Controller implementation.</p></blockquote></div><p>Agreed.</p><div class="quotebox"><blockquote><p>I would also conjecture that a hacker could use a registration interface to discern the same data.</p></blockquote></div><p>Registration forms should be protected with a captcha functionality, making it hard to automate this process. Some applications might also have a non-public register interface.</p>]]></content>
			<author>
				<name><![CDATA[Reen]]></name>
			</author>
			<updated>2010-02-03T13:48:05Z</updated>
			<id>http://www.zendcasts.com/forum/post/604/#p604</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: ZC44 – Logging in Users using Doctrine and Zend_Auth]]></title>
			<link rel="alternate" href="http://www.zendcasts.com/forum/post/595/#p595"/>
			<content type="html"><![CDATA[<p>Hi Reen,</p><p>I&#039;m glad you enjoyed the video! I really appreciate your feedback about this project. Let me respond to your comments:</p><div class="quotebox"><cite>Reen wrote:</cite><blockquote><p>Hi Jon,<br />It&#039;s not the responsibility of a user to authenticate it&#039;s self. Like a car should not be able to put a traffic light on green. The logic for authentication should be in the authentication class. You can add a non-static function called verifyPassword, and call that function from the authentication.</p></blockquote></div><p>The user is not authenticating himself, the use Model, however is. I&#039;m also using the Model_User class as a method of storing any business rules related to authentication. If the code were in the authentication class, it would couple the database querying engine (in this case Doctrine) to the authentication code. Alternatively, a data-table gateway could&#039;ve been implemented so that the Model_User class could be used exclusively as a value-object. This, of course, would add to the complexity of the implementation in an area that the video wasn&#039;t focused.</p><div class="quotebox"><cite>Reen wrote:</cite><blockquote><p>Type of exceptions should not be checked by exception message. You can subclass the exception class and check it&#039;s type by using instanceof.</p></blockquote></div><p>There&#039;s been a lot of debate about this within the Zend community, however you&#039;re absolutely right that a OOP purist would do type checking rather than error code checking. However, the disadvantage to such heavy Exception class implementations is that you start creating Exceptions for every single outcome, my own experience of seeing hundreds of lines of catch blocks in Java has led me to prefer a error-code-based comparison, using the Exception model for more generic exception handling. Furthermore, having multiple exceptions and then explaining their use would blur the overall focus of the video, which is the Zend_Controller implementation.</p><div class="quotebox"><cite>Reen wrote:</cite><blockquote><p>Things you probably said in the video:<br />- Passwords should be hashed (with seed);<br />- It is bad practice to show difference between incorrect user and incorrect password, hackers will be able to use your login interface to check for existing users.</p><p>Hope this feedback helps. Keep up the video-tutorials they are great!</p><p>Cheers</p></blockquote></div><p>Thanks for mentioning the passwords here. Of course passwords should be hashed! Preferably with a salt as well. This is mentioned in the video.</p><p>In terms of it being a bad practice to say a user is not found, I&#039;ve never found or read anything of the sort. I&#039;ve also seen this functionality widely used in web applications. I would also conjecture that a hacker could use a registration interface to discern the same data.</p>]]></content>
			<author>
				<name><![CDATA[Jon Lebensold]]></name>
				<uri>http://www.zendcasts.com/forum/user/3/</uri>
			</author>
			<updated>2010-02-01T14:36:12Z</updated>
			<id>http://www.zendcasts.com/forum/post/595/#p595</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: ZC44 – Logging in Users using Doctrine and Zend_Auth]]></title>
			<link rel="alternate" href="http://www.zendcasts.com/forum/post/594/#p594"/>
			<content type="html"><![CDATA[<p>Hi Jon,</p><p>First of all I would like to say that I&#039;m a big fan of your vid&#039;s, makes me view a lot of problems from another perspective.</p><p>I must say I watched the code without really checking the video, but it seems like you are doing some bad practices I would like to notify you about.</p><p>It&#039;s not the responsibility of a user to authenticate it&#039;s self. Like a car should not be able to put a traffic light on green. The logic for authentication should be in the authentication class. You can add a non-static function called verifyPassword, and call that function from the authentication.</p><p>Type of exceptions should not be checked by exception message. You can subclass the exception class and check it&#039;s type by using instanceof.</p><p>Things you probably said in the video:<br />- Passwords should be hashed (with seed);<br />- It is bad practice to show difference between incorrect user and incorrect password, hackers will be able to use your login interface to check for existing users.</p><p>Hope this feedback helps. Keep up the video-tutorials they are great!</p><p>Cheers</p>]]></content>
			<author>
				<name><![CDATA[Reen]]></name>
			</author>
			<updated>2010-02-01T10:15:11Z</updated>
			<id>http://www.zendcasts.com/forum/post/594/#p594</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[ZC44 – Logging in Users using Doctrine and Zend_Auth]]></title>
			<link rel="alternate" href="http://www.zendcasts.com/forum/post/580/#p580"/>
			<content type="html"><![CDATA[<p>Here&#039;s the second part of my Doctrine / Zend_Auth example. In 15 minutes, we create a logout, login and protected area that&#039;s reliant on the ZC_Auth_Adapter adapter we created in last week&#039;s video. Notice how there&#039;s no code in the IndexController exposing the authentication implementation,</p><p>Grab a <a href="http://zendcasts.googlecode.com/svn/trunk/zc44-logging-in-users-using-doctrine-and-zend-auth/zc44-logging-in-users-using-doctrine-and-zend-auth.zip">copy of the project</a> or <a href="http://code.google.com/p/zendcasts/source/browse/#svn/trunk/zc44-logging-in-users-using-doctrine-and-zend-auth">browse the repository</a>.</p><p>Also, a big thank you to ServerGrove for extending their support of Zendcasts for January. ServerGrove specializes in Zend Framework hosting and they&#039;ve offered a 10% rebate on hosting with coupon code &quot;zc&quot;. If you&#039;re looking for a host, be sure to <a href="http://secure.servergrove.com/clients/aff.php?aff=043">check them out (referral)</a>. They&#039;ve also added an additional coupon for &quot;Mini Hosting&quot; plans, get $2 off by using code &quot;zcmini&quot;.</p>]]></content>
			<author>
				<name><![CDATA[Jon Lebensold]]></name>
				<uri>http://www.zendcasts.com/forum/user/3/</uri>
			</author>
			<updated>2010-01-26T22:08:48Z</updated>
			<id>http://www.zendcasts.com/forum/post/580/#p580</id>
		</entry>
</feed>
