mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 17:06:22 +00:00
feat: prueba de antispam
This commit is contained in:
parent
6edd253ef1
commit
0ebd57811d
3 changed files with 24 additions and 1 deletions
20
app/controllers/registrations_controller.rb
Normal file
20
app/controllers/registrations_controller.rb
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Modificaciones locales al registro de usuaries
|
||||||
|
#
|
||||||
|
# @see {https://github.com/heartcombo/devise/wiki/How-To:-Use-Recaptcha-with-Devise}
|
||||||
|
class RegistrationsController < Devise::RegistrationsController
|
||||||
|
class SpambotError < StandardError; end
|
||||||
|
|
||||||
|
prepend_before_action :anti_spambot_traps, only: %i[create]
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
# Detecta spambots simples
|
||||||
|
def anti_spambot_traps
|
||||||
|
raise SpambotError if params.dig(:usuarie, :name).blank?
|
||||||
|
rescue SpambotError => e
|
||||||
|
ExceptionNotifier.notify_exception(e, data: { params: params })
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
|
@ -12,6 +12,9 @@
|
||||||
as: resource_name,
|
as: resource_name,
|
||||||
url: registration_path(resource_name, params: { locale: params[:locale] })) do |f|
|
url: registration_path(resource_name, params: { locale: params[:locale] })) do |f|
|
||||||
|
|
||||||
|
.d-none
|
||||||
|
= f.text_field :name, autocomplete: 'off'
|
||||||
|
|
||||||
.form-group
|
.form-group
|
||||||
= f.label :email, class: 'sr-only'
|
= f.label :email, class: 'sr-only'
|
||||||
= f.email_field :email, autofocus: true, autocomplete: 'email',
|
= f.email_field :email, autofocus: true, autocomplete: 'email',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
devise_for :usuaries
|
devise_for :usuaries, controllers: { registrations: 'registrations' }
|
||||||
get '/.well-known/change-password', to: redirect('/usuaries/edit')
|
get '/.well-known/change-password', to: redirect('/usuaries/edit')
|
||||||
|
|
||||||
require 'que/web'
|
require 'que/web'
|
||||||
|
|
Loading…
Reference in a new issue