Class: SessionsController

Inherits:
Devise::SessionsController
  • Object
show all
Includes:
AuthenticatesWithTwoFactor, Recaptcha::ClientHelper
Defined in:
app/controllers/sessions_controller.rb

Instance Method Summary collapse

Methods included from AuthenticatesWithTwoFactor

#prompt_for_two_factor

Instance Method Details

#createObject


25
26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/sessions_controller.rb', line 25

def create
  super do |resource|
    # User has successfully signed in, so clear any unused reset token
    if resource.reset_password_token.present?
      resource.update_attributes(reset_password_token: nil,
                                 reset_password_sent_at: nil)
    end
    authenticated_with = user_params[:otp_attempt] ? "two-factor" : "standard"
    log_audit_event(current_user, with: authenticated_with)
  end
end

#newObject


15
16
17
18
19
20
21
22
23
# File 'app/controllers/sessions_controller.rb', line 15

def new
  if Gitlab.config.ldap.enabled
    @ldap_servers = Gitlab::LDAP::Config.servers
  else
    @ldap_servers = []
  end

  super
end