orbit-basic/app/controllers/sessions_controller.rb

27 lines
945 B
Ruby

class SessionsController < Devise::SessionsController
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
include Devise::Controllers::InternalHelpers
# POST /resource/sign_in
def create
# login_password = params[:user][:password]
# login_uid = params[:user][:nccu_ldap_uid]
login_password = params[:user][:password]
login_email = params[:user][:email]
result = false
resource = User.first(conditions:{ email: login_email })
set_flash_message(:notice, :signed_in) if is_navigational_format?
if resource.nil?
logger.error "Can't find user #{login_email}"
flash[:notice] = t('devise.failure.invalid')
render :action => "new"
else
logger.info "=== passed"
resource_name = resource.class.to_s.downcase
sign_in(resource_name, resource)
respond_with resource, :location => redirect_location(resource_name, resource)
end
end
end