custom message for rails 4 sorcery brute force protection sub-module
<p>I'm using the sorcery gem brute force protection sub-module in my rails app. When the user has exceeded the allowed number of attempts to sign in, I'd like to provide a custom message. I haven't been able to find anything in the documentation or online that allows the messages to be configured. </p>

<p>Here's how I handled it - not sure its the best way so any comments welcome.</p>

<p>sessions_controller.rb</p>

<pre><code>def create
  if login(params[:email], params[:password])
    redirect_to preorders_by_campaign_path
  else
    if is_locked?
      flash[:warning] = "my custom message"
    else
      flash[:warning] = "Invalid email or password"
    end
    render :new
  end
end

def is_locked?
  User.where(email: params[:email]).first.locked?
end
</code></pre>