Sha256: b9c90955a00f2f2c900bc61f45b7e6ec73e1dfeccc68facb142001b3f224b0d0

Contents?: true

Size: 874 Bytes

Versions: 2

Compression:

Stored size: 874 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[:alert] = "Invalid login/password."
      render :new
    end
  end
end

class DashboardController < ActionController::Base
  def index
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_auth-0.1.6 spec/resources/controllers.rb
simple_auth-0.1.5 spec/resources/controllers.rb