OSDN Git Service

user check
[pettanr/pettanr.git] / app / controllers / home_controller.rb
index 0b64ee9..e022d0d 100644 (file)
@@ -1,5 +1,5 @@
 class HomeController < ApplicationController
-  before_filter :authenticate_author!, :only => [
+  before_filter :authenticate_user!, :only => [
     :index, :show, :profile, :configure, :create_token, :delete_token, :step2, :save_step2, :step3, :save_step3, 
     :comic, :picture
   ]
@@ -14,10 +14,9 @@ class HomeController < ApplicationController
   end
   
   def create_token
-    @author = current_author
     respond_to do |format|
-      if @author.create_token
-        format.html { redirect_to({:action => :configure}, {:notice => 'author token was successfully created.'}) }
+      if @user.create_token
+        format.html { redirect_to({:action => :configure}, {:notice => 'user token was successfully created.'}) }
       else
         format.html { render action: "auth_token" }
       end
@@ -25,18 +24,16 @@ class HomeController < ApplicationController
   end
   
   def delete_token
-    current_author.delete_token
+    @user.delete_token
     respond_to do |format|
       format.html { redirect_to :action => :configure}
     end
   end
   
   def step2
-    @author = current_author
   end
   
   def save_step2
-    @author = current_author
     respond_to do |format|
       if @author.step2(params[:author][:name])
         a = if params[:step3].to_i == 1
@@ -52,11 +49,10 @@ class HomeController < ApplicationController
   end
   
   def step3
-    @artist = Artist.new :author_id => current_author.id, :name => current_author.name, :default_license_id => 1
   end
   
   def save_step3
-    if current_author.artist?
+    if @author.artist?
       redirect_to :action => :index
     else
       @artist = Artist.new params[:artist]
@@ -72,7 +68,7 @@ class HomeController < ApplicationController
   
   def comic
     @comics = Comic.find(:all, 
-      :include => :author, :conditions => ['author_id = ?', current_author.id], 
+      :include => :author, :conditions => ['author_id = ?', @author.id], 
       :order => 'updated_at desc', :limit => 20
     )
 
@@ -83,9 +79,9 @@ class HomeController < ApplicationController
   end
   
   def picture
-    if current_author.artist?
+    if @author.artist?
       @original_pictures = OriginalPicture.find(:all, 
-        :include => [:artist, :license, :resource_picture], :conditions => ['artist_id = ?', current_author.artist.id], 
+        :include => [:artist, :license, :resource_picture], :conditions => ['artist_id = ?', @author.artist.id], 
         :order => 'updated_at', :limit => 20
       )