<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Adding your own login method to Authlogic</title>
	<atom:link href="http://www.sentia.com.au/2009/06/adding-your-own-login-method-to-authlogic/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sentia.com.au/2009/06/adding-your-own-login-method-to-authlogic/</link>
	<description>Sentia company website and blog about all things development, Ruby on Rails, Microsoft .Net, ASP.Net, C#.Net, Agile web development, Test Driven Development</description>
	<lastBuildDate>Wed, 11 Jan 2012 14:17:22 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Daniele Demichelis</title>
		<link>http://www.sentia.com.au/2009/06/adding-your-own-login-method-to-authlogic/comment-page-1/#comment-326</link>
		<dc:creator>Daniele Demichelis</dc:creator>
		<pubDate>Sat, 29 Jan 2011 18:33:57 +0000</pubDate>
		<guid isPermaLink="false">http://sentia.com.au/?p=294#comment-326</guid>
		<description>Hi, 
I just implemented it to check if the user previously activated his account providing a token that is the same of perishable_token, and it worked perfectly! Thanks.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I just implemented it to check if the user previously activated his account providing a token that is the same of perishable_token, and it worked perfectly! Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Cindric</title>
		<link>http://www.sentia.com.au/2009/06/adding-your-own-login-method-to-authlogic/comment-page-1/#comment-311</link>
		<dc:creator>Michael Cindric</dc:creator>
		<pubDate>Mon, 05 Jul 2010 00:27:38 +0000</pubDate>
		<guid isPermaLink="false">http://sentia.com.au/?p=294#comment-311</guid>
		<description>Hi Joshua,

Yep got it working fine just ensure that you are using the rails3 branch of authlogic</description>
		<content:encoded><![CDATA[<p>Hi Joshua,</p>
<p>Yep got it working fine just ensure that you are using the rails3 branch of authlogic</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joshua</title>
		<link>http://www.sentia.com.au/2009/06/adding-your-own-login-method-to-authlogic/comment-page-1/#comment-310</link>
		<dc:creator>Joshua</dc:creator>
		<pubDate>Fri, 02 Jul 2010 17:10:30 +0000</pubDate>
		<guid isPermaLink="false">http://sentia.com.au/?p=294#comment-310</guid>
		<description>Hi,

I&#039;ve tried this with Rails 3 and it seems to be broken. Have you by any chance tried this with Rails 3?</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I&#8217;ve tried this with Rails 3 and it seems to be broken. Have you by any chance tried this with Rails 3?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Cindric</title>
		<link>http://www.sentia.com.au/2009/06/adding-your-own-login-method-to-authlogic/comment-page-1/#comment-184</link>
		<dc:creator>Michael Cindric</dc:creator>
		<pubDate>Fri, 07 Aug 2009 18:26:40 +0000</pubDate>
		<guid isPermaLink="false">http://sentia.com.au/?p=294#comment-184</guid>
		<description>Cool thanks for finding that. That should fix the issue.  Your right so much better working through the issue with another dev thanks.</description>
		<content:encoded><![CDATA[<p>Cool thanks for finding that. That should fix the issue.  Your right so much better working through the issue with another dev thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bradley Kieser</title>
		<link>http://www.sentia.com.au/2009/06/adding-your-own-login-method-to-authlogic/comment-page-1/#comment-183</link>
		<dc:creator>Bradley Kieser</dc:creator>
		<pubDate>Fri, 07 Aug 2009 09:54:15 +0000</pubDate>
		<guid isPermaLink="false">http://sentia.com.au/?p=294#comment-183</guid>
		<description>Just seen this solution posted by PhattyMatty at googlegroups:
http://groups.google.com/group/authlogic/browse_thread/thread/8c341f4d0af8045f

You&#039;ll want to use validations_scope to do this. Look into this and
authenticates_many for details.

You may have something like this in your models:

class User &lt; ActiveRecord::Base
    acts_as_authentic do &#124;c&#124;
    c.validations_scope = :company_id
  end
  [.....associations, etc ....]
end

class Company &lt; ActiveRecord::Base
  authenticates_many :user_sessions
  [.....associations, etc ....]
end

This much should allow you to create the same user/email for different
companies.

Your sessions controller will have to be updated to reflect that you
are scoping the user to a company for the new, create, and destroy
actions. How you implement this in your app is up to you. Hope this
helps.</description>
		<content:encoded><![CDATA[<p>Just seen this solution posted by PhattyMatty at googlegroups:<br />
<a href="http://groups.google.com/group/authlogic/browse_thread/thread/8c341f4d0af8045f" rel="nofollow">http://groups.google.com/group/authlogic/browse_thread/thread/8c341f4d0af8045f</a></p>
<p>You&#8217;ll want to use validations_scope to do this. Look into this and<br />
authenticates_many for details.</p>
<p>You may have something like this in your models:</p>
<p>class User &lt; ActiveRecord::Base<br />
    acts_as_authentic do |c|<br />
    c.validations_scope = :company_id<br />
  end<br />
  [.....associations, etc ....]<br />
end</p>
<p>class Company &lt; ActiveRecord::Base<br />
  authenticates_many :user_sessions<br />
  [.....associations, etc ....]<br />
end</p>
<p>This much should allow you to create the same user/email for different<br />
companies.</p>
<p>Your sessions controller will have to be updated to reflect that you<br />
are scoping the user to a company for the new, create, and destroy<br />
actions. How you implement this in your app is up to you. Hope this<br />
helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bradley Kieser</title>
		<link>http://www.sentia.com.au/2009/06/adding-your-own-login-method-to-authlogic/comment-page-1/#comment-182</link>
		<dc:creator>Bradley Kieser</dc:creator>
		<pubDate>Fri, 07 Aug 2009 09:48:35 +0000</pubDate>
		<guid isPermaLink="false">http://sentia.com.au/?p=294#comment-182</guid>
		<description>Hey Michael, thanks a ton! It&#039;s great to be able to discuss this with someone. I was worried that I was missing something really obvious! I did think of concatenating the two fields into one but that really is a bit of a nasty hack and will create problems further down the line.

I guess that authlogic assumes a slightly lower position in the systems&#039; tree than we need to peg it at. I.e. No authentication branches below it, whereas we are further up the tree with multiple branches below the authentication layer.</description>
		<content:encoded><![CDATA[<p>Hey Michael, thanks a ton! It&#8217;s great to be able to discuss this with someone. I was worried that I was missing something really obvious! I did think of concatenating the two fields into one but that really is a bit of a nasty hack and will create problems further down the line.</p>
<p>I guess that authlogic assumes a slightly lower position in the systems&#8217; tree than we need to peg it at. I.e. No authentication branches below it, whereas we are further up the tree with multiple branches below the authentication layer.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Cindric</title>
		<link>http://www.sentia.com.au/2009/06/adding-your-own-login-method-to-authlogic/comment-page-1/#comment-181</link>
		<dc:creator>Michael Cindric</dc:creator>
		<pubDate>Thu, 06 Aug 2009 22:47:34 +0000</pubDate>
		<guid isPermaLink="false">http://sentia.com.au/?p=294#comment-181</guid>
		<description>Hi Brad,

Yeah the only way l think would be to fork it from what l can see quickly reviewing the gem. A shame really would have thought you could do that simply guess they are just trying to make is as secure as possible. 

Good luck with it and let me know if l can help at all and how you go</description>
		<content:encoded><![CDATA[<p>Hi Brad,</p>
<p>Yeah the only way l think would be to fork it from what l can see quickly reviewing the gem. A shame really would have thought you could do that simply guess they are just trying to make is as secure as possible. </p>
<p>Good luck with it and let me know if l can help at all and how you go</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bradley Kieser</title>
		<link>http://www.sentia.com.au/2009/06/adding-your-own-login-method-to-authlogic/comment-page-1/#comment-180</link>
		<dc:creator>Bradley Kieser</dc:creator>
		<pubDate>Thu, 06 Aug 2009 08:53:22 +0000</pubDate>
		<guid isPermaLink="false">http://sentia.com.au/?p=294#comment-180</guid>
		<description>Michael thanks for that. I did actually go down that route but the problem that I ran into is that authlogic passes only the login field to the find_by_login_method. So I wouldn&#039;t get the company_id.

I am thinking that I may need to fork the code and add a company field by cloning the login field handling but obviously I would prefer not to do this!</description>
		<content:encoded><![CDATA[<p>Michael thanks for that. I did actually go down that route but the problem that I ran into is that authlogic passes only the login field to the find_by_login_method. So I wouldn&#8217;t get the company_id.</p>
<p>I am thinking that I may need to fork the code and add a company field by cloning the login field handling but obviously I would prefer not to do this!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Cindric</title>
		<link>http://www.sentia.com.au/2009/06/adding-your-own-login-method-to-authlogic/comment-page-1/#comment-179</link>
		<dc:creator>Michael Cindric</dc:creator>
		<pubDate>Wed, 05 Aug 2009 23:06:47 +0000</pubDate>
		<guid isPermaLink="false">http://sentia.com.au/?p=294#comment-179</guid>
		<description>You should be able to do something like

&lt;code&gt;
class UserSession &lt; Authlogic::Session::Base
  find_by_login_method :find_by_username_and_company_id
end
&lt;/code&gt;

&lt;code&gt;
class User &lt; ActiveRecord::Base
  def self.find_by_username_and_company_id(login, company_id)
    find_by_username_and_company_id(login, company_id)
  end
end
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>You should be able to do something like</p>
<p><code><br />
class UserSession &lt; Authlogic::Session::Base<br />
  find_by_login_method :find_by_username_and_company_id<br />
end<br />
</code></p>
<p><code><br />
class User &lt; ActiveRecord::Base<br />
  def self.find_by_username_and_company_id(login, company_id)<br />
    find_by_username_and_company_id(login, company_id)<br />
  end<br />
end<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bradley Kieser</title>
		<link>http://www.sentia.com.au/2009/06/adding-your-own-login-method-to-authlogic/comment-page-1/#comment-178</link>
		<dc:creator>Bradley Kieser</dc:creator>
		<pubDate>Wed, 05 Aug 2009 15:58:17 +0000</pubDate>
		<guid isPermaLink="false">http://sentia.com.au/?p=294#comment-178</guid>
		<description>This is very helpful! The only problem that I have is that in my case there isn&#039;t one login field but two: A company id field and a username field.

How would I extend authlogic so that instead of using just one field it uses two?</description>
		<content:encoded><![CDATA[<p>This is very helpful! The only problem that I have is that in my case there isn&#8217;t one login field but two: A company id field and a username field.</p>
<p>How would I extend authlogic so that instead of using just one field it uses two?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

