Module: Gitlab::Tracking::Helpers::WeakPasswordErrorEvent

Included in:
PasswordsController, Profiles::PasswordsController, RegistrationsController
Defined in:
lib/gitlab/tracking/helpers/weak_password_error_event.rb

Instance Method Summary collapse

Instance Method Details

#track_weak_password_error(user, controller, method_name) ⇒ Object

Tracks information if a user record has a weak password. No-op unless the error is present.

Captures a minimal set of information, so that GitLab remains unaware of which users / demographics are attempting to choose weak passwords.



13
14
15
16
17
18
19
20
21
22
# File 'lib/gitlab/tracking/helpers/weak_password_error_event.rb', line 13

def track_weak_password_error(user, controller, method_name)
  return unless user.errors[:password].grep(/must not contain commonly used combinations.*/).any?

  Gitlab::Tracking.event(
    'Gitlab::Tracking::Helpers::WeakPasswordErrorEvent',
    'track_weak_password_error',
    controller: controller,
    method: method_name
  )
end