Sha256: bea2b04d1623415e6f263945ce1b91f60a7b3e6801b35d130a4b8e44adfb9352

Contents?: true

Size: 689 Bytes

Versions: 6

Compression:

Stored size: 689 Bytes

Contents

# -*- encoding : utf-8 -*-
module RademadeAdmin
  class SessionsController < RademadeAdmin::AbstractController

    skip_before_action :require_login

    def login
      user = RademadeAdmin::Login.admin(params)
      session[:user_id] = user.id.to_s
      respond_to do |format|
        format.html { redirect_to :controller => 'dashboard', :action => 'index' }
        format.json { render :json => user }
      end
    rescue RademadeAdmin::Login::Error => e
      render :json => { :errors => e.field_messages }, :status => :precondition_failed
    end

    def logout
      session.delete(:user_id)
      redirect_to :controller => 'dashboard', :action => 'login'
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rademade_admin-0.2.2 app/controllers/rademade_admin/sessions_controller.rb
rademade_admin-0.2.1 app/controllers/rademade_admin/sessions_controller.rb
rademade_admin-0.2.0 app/controllers/rademade_admin/sessions_controller.rb
rademade_admin-0.1.6 app/controllers/rademade_admin/sessions_controller.rb
rademade_admin-0.1.5 app/controllers/rademade_admin/sessions_controller.rb
rademade_admin-0.1.4 app/controllers/rademade_admin/sessions_controller.rb