forked from e621ng/e621ng
add recaptcha for signup process
This commit is contained in:
parent
1e413362e3
commit
704816066d
1
Gemfile
1
Gemfile
@ -47,6 +47,7 @@ gem 'bootsnap'
|
||||
gem 'addressable'
|
||||
gem 'httparty'
|
||||
gem 'rakismet'
|
||||
gem 'recaptcha', require: "recaptcha/rails"
|
||||
|
||||
# needed for looser jpeg header compat
|
||||
gem 'ruby-imagespec', :require => "image_spec", :git => "https://github.com/r888888888/ruby-imagespec.git", :branch => "exif-fixes"
|
||||
|
@ -278,6 +278,8 @@ GEM
|
||||
raindrops (0.17.0)
|
||||
rake (12.0.0)
|
||||
rakismet (1.5.4)
|
||||
recaptcha (4.4.1)
|
||||
json
|
||||
ref (2.0.0)
|
||||
representable (2.3.0)
|
||||
uber (~> 0.0.7)
|
||||
@ -434,6 +436,7 @@ DEPENDENCIES
|
||||
radix62 (~> 1.0.1)
|
||||
rails (~> 4.2.0)
|
||||
rakismet
|
||||
recaptcha
|
||||
responders
|
||||
rmagick
|
||||
ruby-imagespec!
|
||||
|
@ -43,12 +43,17 @@ class UsersController < ApplicationController
|
||||
def create
|
||||
@user = User.new(params[:user], :as => CurrentUser.role)
|
||||
@user.last_ip_addr = request.remote_ip
|
||||
@user.save
|
||||
if @user.errors.empty?
|
||||
session[:user_id] = @user.id
|
||||
if verify_recaptcha(model: @user)
|
||||
@user.save
|
||||
if @user.errors.empty?
|
||||
session[:user_id] = @user.id
|
||||
end
|
||||
set_current_user
|
||||
respond_with(@user)
|
||||
else
|
||||
flash[:notice] = "Sign up failed"
|
||||
redirect_to new_user_path
|
||||
end
|
||||
set_current_user
|
||||
respond_with(@user)
|
||||
end
|
||||
|
||||
def update
|
||||
|
@ -15,6 +15,8 @@
|
||||
<%= f.input :password %>
|
||||
<%= f.input :password_confirmation %>
|
||||
<%= f.button :submit, "Sign up", :data => { :disable_with => "Signing up..." } %>
|
||||
|
||||
<%= recaptcha_tags %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user