2012-02-22 06:43:24 +00:00
|
|
|
class SessionsController < Devise::SessionsController
|
|
|
|
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
|
|
|
|
include Devise::Controllers::InternalHelpers
|
|
|
|
|
|
|
|
# POST /resource/sign_in
|
|
|
|
def create
|
2012-03-06 08:41:06 +00:00
|
|
|
# login_password = params[:user][:password]
|
|
|
|
# login_uid = params[:user][:nccu_ldap_uid]
|
2012-02-22 06:43:24 +00:00
|
|
|
login_password = params[:user][:password]
|
2012-10-24 10:40:38 +00:00
|
|
|
login_email = params[:user][:email]
|
2012-02-22 06:43:24 +00:00
|
|
|
result = false
|
2012-10-18 10:36:21 +00:00
|
|
|
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)
|
2012-02-22 06:43:24 +00:00
|
|
|
end
|
2012-05-15 03:28:24 +00:00
|
|
|
end
|
|
|
|
|
2012-03-20 06:38:01 +00:00
|
|
|
end
|