app/controllers/sessions_controller.rb
# logging in with account_name and password and starting session if authenticated
logging in with account_name and password and starting session if authenticated
logging in with account_name and password and starting session if authenticated
def create
    if @logged_in = session[:account]  
      render :partial => "new", :layout => "application"
      return false
    end
    @login = Account.new(params[:account])
    account = @login.authenticate   
    session[:account] = account.id
    last_request, session[:last_request] = session[:last_request], nil
    last_request ? redirect_to(last_request) : redirect_to(:controller => "/article_threads")    
 	rescue => e      
    session[:account] = nil
    flash[:error] = "ログインに失敗しました．"  + e
    redirect_to( new_session_url( params.merge(:action => :new) ))
  end
def create if @logged_in = session [ :account ] render :partial => "new" , :layout => "application" return false end @login = Account . new ( params [ :account ] ) account = @login . authenticate session [ :account ] = account . id last_request , session [ :last_request ] = session [ :last_request ] , nil last_request ? redirect_to ( last_request ) : redirect_to ( :controller => "/article_threads" ) rescue => e session [ :account ] = nil flash [ :error ] = "ログインに失敗しました．"  + e redirect_to ( new_session_url ( params . merge ( :action => :new ) ) ) end
logging in with account_name and password and starting session if authenticated
logging in with account_name and password and starting session if authenticated
# alreacy logged in by other page. # restore the last login-required request: if no last request, redirect to article_threads # not authenticated