Class: Chaltron::OmniauthCallbacksController

Inherits:
Devise::OmniauthCallbacksController
  • Object
show all
Defined in:
app/controllers/chaltron/omniauth_callbacks_controller.rb

Instance Method Summary collapse

Instance Method Details

#ldapObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/chaltron/omniauth_callbacks_controller.rb', line 8

def ldap
#      puts '##########################################'
#      puts oauth.inspect
#      puts '##########################################'
  # We only find ourselves here
  # if the authentication to LDAP was successful.
  user = Chaltron::LDAP::User.find_or_create(oauth, Chaltron.ldap_allow_all)
  if user.nil?
    redirect_to new_user_session_url, alert: I18n.t('chaltron.not_allowed_to_sign_in')
  else
    user.remember_me = params[:remember_me] if user.persisted?
    (user, event: :authentication)
    set_flash_message(:notice, :success, kind: 'LDAP')
  end
end