<?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: 5 Minute Beta Authentication in Rails</title>
	<atom:link href="http://www.igvita.com/2007/06/21/5-minute-beta-authentication-in-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.igvita.com/2007/06/21/5-minute-beta-authentication-in-rails/</link>
	<description>A goal is a dream with a deadline.</description>
	<pubDate>Mon, 15 Mar 2010 15:21:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Micah</title>
		<link>http://www.igvita.com/2007/06/21/5-minute-beta-authentication-in-rails/comment-page-1/#comment-172627</link>
		<dc:creator>Micah</dc:creator>
		<pubDate>Thu, 26 Feb 2009 03:15:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.igvita.com/blog/2007/06/21/5-minute-beta-authentication-in-rails/#comment-172627</guid>
		<description>I started following this tutorial today for a new site I'm spinning up.  Then, I looked at the comments and saw my smug face from 2 years ago explaining how you should think before shutting out your visitors.

Ah, the innocence of youth...</description>
		<content:encoded><![CDATA[<p>I started following this tutorial today for a new site I&#8217;m spinning up.  Then, I looked at the comments and saw my smug face from 2 years ago explaining how you should think before shutting out your visitors.</p>
<p>Ah, the innocence of youth&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ilya Radchenko</title>
		<link>http://www.igvita.com/2007/06/21/5-minute-beta-authentication-in-rails/comment-page-1/#comment-151156</link>
		<dc:creator>Ilya Radchenko</dc:creator>
		<pubDate>Sat, 06 Dec 2008 21:07:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.igvita.com/blog/2007/06/21/5-minute-beta-authentication-in-rails/#comment-151156</guid>
		<description>I have had a lousy time with restful_authenticated, for some reason I think sessions aren't working for me. Im either just gona go with a_a_a, or authlogic which looks really good. Looks like the author took the same clean approach that we rubiers love. And we'll documented. Can't wait to dig in!</description>
		<content:encoded><![CDATA[<p>I have had a lousy time with restful_authenticated, for some reason I think sessions aren&#8217;t working for me. Im either just gona go with a_a_a, or authlogic which looks really good. Looks like the author took the same clean approach that we rubiers love. And we&#8217;ll documented. Can&#8217;t wait to dig in!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ilya Grigorik</title>
		<link>http://www.igvita.com/2007/06/21/5-minute-beta-authentication-in-rails/comment-page-1/#comment-102266</link>
		<dc:creator>Ilya Grigorik</dc:creator>
		<pubDate>Sun, 30 Mar 2008 01:39:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.igvita.com/blog/2007/06/21/5-minute-beta-authentication-in-rails/#comment-102266</guid>
		<description>Cedric, are you volunteering? ;)</description>
		<content:encoded><![CDATA[<p>Cedric, are you volunteering? ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cédric DELTHEIL</title>
		<link>http://www.igvita.com/2007/06/21/5-minute-beta-authentication-in-rails/comment-page-1/#comment-102231</link>
		<dc:creator>Cédric DELTHEIL</dc:creator>
		<pubDate>Tue, 25 Mar 2008 12:36:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.igvita.com/blog/2007/06/21/5-minute-beta-authentication-in-rails/#comment-102231</guid>
		<description>Thank you guys!

I used this hack with Ilya's recipe in a customized version of restful_authentication. Wouldn't it be great to package this stuff in a plugin?!</description>
		<content:encoded><![CDATA[<p>Thank you guys!</p>
<p>I used this hack with Ilya&#8217;s recipe in a customized version of restful_authentication. Wouldn&#8217;t it be great to package this stuff in a plugin?!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ilya Grigorik</title>
		<link>http://www.igvita.com/2007/06/21/5-minute-beta-authentication-in-rails/comment-page-1/#comment-102112</link>
		<dc:creator>Ilya Grigorik</dc:creator>
		<pubDate>Tue, 18 Mar 2008 12:34:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.igvita.com/blog/2007/06/21/5-minute-beta-authentication-in-rails/#comment-102112</guid>
		<description>Go Cedric, go!</description>
		<content:encoded><![CDATA[<p>Go Cedric, go!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BM5k</title>
		<link>http://www.igvita.com/2007/06/21/5-minute-beta-authentication-in-rails/comment-page-1/#comment-102086</link>
		<dc:creator>BM5k</dc:creator>
		<pubDate>Mon, 17 Mar 2008 09:38:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.igvita.com/blog/2007/06/21/5-minute-beta-authentication-in-rails/#comment-102086</guid>
		<description>It's been quite a while, but I wanted to say thanks for this example! I'm using a modified version of Cédric's code in my project It's a LOT cleaner and easier than what I was trying to do.</description>
		<content:encoded><![CDATA[<p>It&#8217;s been quite a while, but I wanted to say thanks for this example! I&#8217;m using a modified version of Cédric&#8217;s code in my project It&#8217;s a LOT cleaner and easier than what I was trying to do.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ilya Grigorik</title>
		<link>http://www.igvita.com/2007/06/21/5-minute-beta-authentication-in-rails/comment-page-1/#comment-100709</link>
		<dc:creator>Ilya Grigorik</dc:creator>
		<pubDate>Thu, 27 Dec 2007 05:01:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.igvita.com/blog/2007/06/21/5-minute-beta-authentication-in-rails/#comment-100709</guid>
		<description>Cedric, clever stuff and nice pattern! I can think of a few spots where I can refactor my code to take advantage of this approach. :)</description>
		<content:encoded><![CDATA[<p>Cedric, clever stuff and nice pattern! I can think of a few spots where I can refactor my code to take advantage of this approach. :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cédric DELTHEIL</title>
		<link>http://www.igvita.com/2007/06/21/5-minute-beta-authentication-in-rails/comment-page-1/#comment-98481</link>
		<dc:creator>Cédric DELTHEIL</dc:creator>
		<pubDate>Fri, 14 Dec 2007 20:42:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.igvita.com/blog/2007/06/21/5-minute-beta-authentication-in-rails/#comment-98481</guid>
		<description>Hi Ilya. In the approach I described you don't have to add any additional column since I make use of a virtual attribute on User class (exactly as acts_as_authenticated does with the unencrypted password).

It takes 5 lines of code including the validators:

&lt;code&gt;
class User &lt; ActiveRecord::Base
  # Virtual attribute
  attr_accessor :beta_key
  
  validates_presence_of :beta_key, :if =&gt; Proc.new { &#124;user&#124; user.new_record? }, :message =&gt; "Please type in your beta key"
  validates_each :beta_key, :if =&gt; Proc.new { &#124;user&#124; user.new_record? }, :allow_nil =&gt; true do &#124;record, attr, value&#124;
    record.errors.add attr, "Invalid key" unless value == BetaKey.generate(record.email)
  end

  # ...
end
&lt;/code&gt;

Finally it's quite simple and efficient!</description>
		<content:encoded><![CDATA[<p>Hi Ilya. In the approach I described you don&#8217;t have to add any additional column since I make use of a virtual attribute on User class (exactly as acts_as_authenticated does with the unencrypted password).</p>
<p>It takes 5 lines of code including the validators:</p>
<p><code><br />
class User < ActiveRecord::Base<br />
  # Virtual attribute<br />
  attr_accessor :beta_key</p>
<p>  validates_presence_of :beta_key, :if => Proc.new { |user| user.new_record? }, :message => &#8220;Please type in your beta key&#8221;<br />
  validates_each :beta_key, :if => Proc.new { |user| user.new_record? }, :allow_nil => true do |record, attr, value|<br />
    record.errors.add attr, &#8220;Invalid key&#8221; unless value == BetaKey.generate(record.email)<br />
  end</p>
<p>  # &#8230;<br />
end<br />
</code></p>
<p>Finally it&#8217;s quite simple and efficient!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ilya Grigorik</title>
		<link>http://www.igvita.com/2007/06/21/5-minute-beta-authentication-in-rails/comment-page-1/#comment-98453</link>
		<dc:creator>Ilya Grigorik</dc:creator>
		<pubDate>Fri, 14 Dec 2007 16:25:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.igvita.com/blog/2007/06/21/5-minute-beta-authentication-in-rails/#comment-98453</guid>
		<description>Cedric, that could certainly work. The only reason I decided against such an approach was due to additional maintenance of the database schemas once you remove the 'beta'. I didn't want to store an additional column of data in DB.. Having said that, you can define validations that don't have to query a database, so you can still your approach as you described it.</description>
		<content:encoded><![CDATA[<p>Cedric, that could certainly work. The only reason I decided against such an approach was due to additional maintenance of the database schemas once you remove the &#8216;beta&#8217;. I didn&#8217;t want to store an additional column of data in DB.. Having said that, you can define validations that don&#8217;t have to query a database, so you can still your approach as you described it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cédric DELTHEIL</title>
		<link>http://www.igvita.com/2007/06/21/5-minute-beta-authentication-in-rails/comment-page-1/#comment-97807</link>
		<dc:creator>Cédric DELTHEIL</dc:creator>
		<pubDate>Tue, 11 Dec 2007 22:53:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.igvita.com/blog/2007/06/21/5-minute-beta-authentication-in-rails/#comment-97807</guid>
		<description>Hello Ilya. Very helpful article!

Here's a suggestion. Let's suppose you have a User model to hold the account information (not very original, isn't it ?!).

Guarding the sign-up could be viewed as adding validations to User.

So what about creating a beta_key virtual attribute for User (attr_accessor :beta_key) ? This allows to easily implement validators (presence and verification), use the form_for helper with a text field for key and take benefit of the various error message helpers when the validation fails.

I tried this on my own and it works pretty well.</description>
		<content:encoded><![CDATA[<p>Hello Ilya. Very helpful article!</p>
<p>Here&#8217;s a suggestion. Let&#8217;s suppose you have a User model to hold the account information (not very original, isn&#8217;t it ?!).</p>
<p>Guarding the sign-up could be viewed as adding validations to User.</p>
<p>So what about creating a beta_key virtual attribute for User (attr_accessor :beta_key) ? This allows to easily implement validators (presence and verification), use the form_for helper with a text field for key and take benefit of the various error message helpers when the validation fails.</p>
<p>I tried this on my own and it works pretty well.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
