Sha256: 9cd23f6dafaf55d3b09cd47042071ef44acba13fc38944de806617f8de4cdcf0

Contents?: true

Size: 839 Bytes

Versions: 41

Compression:

Stored size: 839 Bytes

Contents

<%= @app_name %>::<%= @admin_name %>.controllers :sessions do
  get :new do
    render "/sessions/new", nil, :layout => false
  end

  post :create do
    if account = <%= @model_name %>.authenticate(params[:email], params[:password])
      set_current_account(account)
      redirect url(:base, :index)
    elsif Padrino.env == :development && params[:bypass]
      <%- if @orm == :ohm -%>
      account = <%= @model_name %>.all.first
      <%- else -%>
      account = <%= @model_name %>.first
      <%- end -%>
      set_current_account(account)
      redirect url(:base, :index)
    else
      params[:email] = h(params[:email])
      flash.now[:error] = pat('login.error')
      render "/sessions/new", nil, :layout => false
    end
  end

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

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
padrino-admin-0.16.0.pre3 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.16.0.pre2 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.15.3 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.15.2 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.15.1 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.15.0 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.14.4 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.14.3 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.12.9 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.14.2 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.13.3.4 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.14.1.1 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.14.1 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.14.0.2 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.14.0.1 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.14.0 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.14.0.rc2 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.14.0.rc1 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.13.3.3 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
padrino-admin-0.13.3.2 lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt