diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-03-22 13:34:42 +0300 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-03-22 19:05:15 +0300 |
commit | 161a05b963b83fe50961ef41eebc5d1c28c3110e (patch) | |
tree | 5c98f6bc35eaea98652bb8cb9497ebac97b97667 /app | |
parent | f742010257b0aa00a999ef5e20a17c15f980f4c1 (diff) |
Writes specs
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/omniauth_callbacks_controller.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index fed8ba3ce28..5e6676ea513 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -21,9 +21,11 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController # Extend the standard implementation to also increment # the number of failed sign in attempts def failure - user = User.find_by_username(params[:username]) + if params[:username].present? && AuthHelper.form_based_provider?(failed_strategy.name) + user = User.by_login(params[:username]) - user&.increment_failed_attempts! + user&.increment_failed_attempts! + end super end |