<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -16,8 +16,8 @@ class PeopleController &lt; ApplicationController
   
   def show
     @person = Person.find(params[:id], :include =&gt; :activities)
-    if @person.deactivated? and not current_person.admin?
-      flash[:error] = &quot;That person is not activated&quot;
+    unless @person.active? or current_person.admin?
+      flash[:error] = &quot;That person is not active&quot;
       redirect_to home_url and return
     end
     if logged_in?</diff>
      <filename>app/controllers/people_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,8 @@ class SessionsController &lt; ApplicationController
       if person.deactivated?
         flash[:error] = &quot;Your account has been deactivated&quot;
         redirect_to home_url and return
-      elsif global_prefs.email_verifications? and not person.email_verified?
+      elsif global_prefs.email_verifications? and 
+            not person.email_verified? and not person.admin?
         flash[:notice] = %(Unverified email address. 
                            Please check your email for your activation code.)
         redirect_to login_url and return</diff>
      <filename>app/controllers/sessions_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,14 @@
 class AddEmailVerified &lt; ActiveRecord::Migration
   def self.up
     add_column :people, :email_verified, :boolean, :default =&gt; nil
+    if Preference.find(:first).email_verifications?
+      # This is to modify the database for the splitting between
+      # 'deactivated' and 'email_verified'.
+      Person.find(:all).each do |person|
+        person.email_verified = !person.deactivated?
+        person.save
+      end
+    end rescue nil
   end
 
   def self.down</diff>
      <filename>db/migrate/023_add_email_verified.rb</filename>
    </modified>
    <modified>
      <diff>@@ -48,7 +48,16 @@ describe PeopleController do
       @person.toggle!(:deactivated)
       get :show, :id =&gt; @person
       response.should redirect_to(home_url)
-      flash[:error].should =~ /not activated/
+      flash[:error].should =~ /not active/
+    end
+    
+    it &quot;should redirect to home for email unverified users&quot; do
+      enable_email_notifications
+      @person.email_verified = false; @person.save!
+      @person.should_not be_active
+      get :show, :id =&gt; @person
+      response.should redirect_to(home_url)
+      flash[:error].should =~ /not active/
     end
   end
   </diff>
      <filename>spec/controllers/people_controller_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>983283f3dc62c08424cc26aaf133c4402797346c</id>
    </parent>
  </parents>
  <author>
    <name>Michael Hartl</name>
    <email>michael@michaelhartl.com</email>
  </author>
  <url>http://github.com/valodzka/insoshi/commit/b2442c9a907ba387eaf6374367979b048293b88a</url>
  <id>b2442c9a907ba387eaf6374367979b048293b88a</id>
  <committed-date>2008-05-21T11:50:03-07:00</committed-date>
  <authored-date>2008-05-21T11:50:03-07:00</authored-date>
  <message>Last of the polish on email_verified</message>
  <tree>1399e52f21ceed89052ae6b3e1ef409343454d04</tree>
  <committer>
    <name>Michael Hartl</name>
    <email>michael@michaelhartl.com</email>
  </committer>
</commit>
