Sha256: a9216998a47fcc61a104272212944f58658e9fef5303689a9de44dd8d817ac67

Contents?: true

Size: 620 Bytes

Versions: 6

Compression:

Stored size: 620 Bytes

Contents

Admin.controllers :sessions do

  get :new do
    render "/sessions/new", nil, :layout => false
  end

  post :create do
    if account = Account.authenticate(params[:email], params[:password])
      set_current_account(account)
      redirect url(:base, :index)
    elsif Padrino.env == :development && params[:bypass]
      account = Account.first
      set_current_account(account)
      redirect url(:base, :index)
    else
      flash[:warning] = "Login or password wrong."
      redirect url(:sessions, :new)
    end
  end

  get :destroy do
    set_current_account(nil)
    redirect url(:sessions, :new)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
padrino-admin-0.9.24 lib/padrino-admin/generators/templates/app/controllers/sessions.rb
padrino-admin-0.9.23 lib/padrino-admin/generators/templates/app/controllers/sessions.rb
padrino-admin-0.9.22 lib/padrino-admin/generators/templates/app/controllers/sessions.rb
padrino-admin-0.9.21 lib/padrino-admin/generators/templates/app/controllers/sessions.rb
padrino-admin-0.9.20 lib/padrino-admin/generators/templates/app/controllers/sessions.rb
padrino-admin-0.9.19 lib/padrino-admin/generators/templates/app/controllers/sessions.rb