Sha256: e270541093390c97ebdca3eaf83dec764c8f5d932d73982ba3a597b288a89264

Contents?: true

Size: 876 Bytes

Versions: 5

Compression:

Stored size: 876 Bytes

Contents

# Add routes
ActionController::Routing::Routes.add_route "/:controller/:action/:id"
ActionController::Routing::Routes.add_named_route :login, "/login", :controller => "session", :action => "new"
ActionController::Routing::Routes.add_named_route :dashboard, "/dashboard", :controller => "dashboard", :action => "index"

class SampleController < ActionController::Base
end

class SessionController < ActionController::Base
  redirect_logged_user :to => {:controller => "dashboard"}

  def new
    @user_session = SimpleAuth::Session.new
  end

  def create
    @user_session = SimpleAuth::Session.new(params[:session])

    if @user_session.save
      redirect_to session.delete(:return_to) || dashboard_path
    else
      flash[:warning] = "Invalid login/password."
      render :new
    end
  end
end

class DashboardController < ActionController::Base
  def index
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
simple_auth-0.1.4 spec/resources/controllers.rb
simple_auth-0.1.3 spec/resources/controllers.rb
simple_auth-0.1.2 spec/resources/controllers.rb
simple_auth-0.1.1 spec/resources/controllers.rb
simple_auth-0.1.0 spec/resources/controllers.rb