gem "httparty"
#environment stuff
gem "dotenv"
+#humanity verification
+gem "hcaptcha"
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"
#api stuff
erubi (1.13.0)
globalid (1.2.1)
activesupport (>= 6.1)
+ hcaptcha (7.1.0)
+ json
httparty (0.22.0)
csv
mini_mime (>= 1.0.0)
debug
devise
dotenv
+ hcaptcha
httparty
jsonapi-serializer
kaminari
--- /dev/null
+class Users::RegistrationsController < Devise::RegistrationsController
+ prepend_before_action :check_captcha, only: [:create]
+
+ private
+
+ def check_captcha
+ unless verify_hcaptcha
+ self.resource = resource_class.new sign_up_params
+ resource.validate
+ set_minimum_password_length
+ resource.errors.add(:base, 'Please verify that you are not a robot')
+ respond_with_navigational(resource) { render :new }
+ end
+ end
+
+ def sign_up_params
+ params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation)
+ end
+end
\ No newline at end of file
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
- devise :database_authenticatable, # :registerable,
+ devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable,
:confirmable
<%= f.label :password_confirmation %>
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
</div>
+
+ <div class="field">
+ <%= hcaptcha_tags %>
+ </div>
<div class="actions">
<%= f.submit "Sign up" %>
get 'export', to: 'posts#export'
post 'import', to: 'posts#import'
resources :api_keys
- devise_for :users
+ devise_for :users, controllers: { registrations: 'users/registrations' }
resources :posts
get '/feed', to: 'pubview#rss', as: 'rss', defaults: { format: 'rss' }
get '/feed/dispatches', to: 'pubview#dispatches_rss', as: 'dispatches_rss', defaults: { format: 'rss' }