[Login] Add captcha to login page.

This commit is contained in:
Kira 2022-01-09 12:39:53 -08:00
parent a8276c4775
commit d532cd28c5
4 changed files with 10 additions and 3 deletions

View File

@ -4,6 +4,9 @@ class SessionsController < ApplicationController
end
def create
if !verify_recaptcha()
return redirect_to(new_session_path, :notice => "Username/Password was incorrect")
end
session_creator = SessionCreator.new(session, cookies, params[:name], params[:password], request.remote_ip, params[:remember], request.ssl?)
if session_creator.authenticate

View File

@ -20,6 +20,10 @@
<label for="remember" id="remember-label">Remember</label>
</div>
<% if Danbooru.config.enable_recaptcha? %>
<%= recaptcha_tags theme: 'dark', nonce: content_security_policy_nonce %>
<% end %>
<div class="input">
<%= submit_tag "Submit", :data => { :disable_with => "Signing in..." } %>
</div>

View File

@ -21,9 +21,7 @@
<%= f.input :time_zone, :include_blank => false %>
<% if Danbooru.config.enable_recaptcha? %>
<%= recaptcha_tags theme: 'dark', nonce: content_security_policy_nonce %>
<% end %>
<%= recaptcha_tags theme: 'dark', nonce: content_security_policy_nonce %>
<%= f.submit "Sign up", :data => { :disable_with => "Signing up..." } %>
<% end %>
</div>

View File

@ -61,4 +61,6 @@ Rails.application.configure do
# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
config.hosts << 'e621ng.local'
end