5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 11:36:21 +00:00

feat: prueba de antispam

This commit is contained in:
f 2024-10-30 18:03:23 -03:00
parent 6edd253ef1
commit 0ebd57811d
No known key found for this signature in database
3 changed files with 24 additions and 1 deletions

View 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

View file

@ -12,6 +12,9 @@
as: resource_name,
url: registration_path(resource_name, params: { locale: params[:locale] })) do |f|
.d-none
= f.text_field :name, autocomplete: 'off'
.form-group
= f.label :email, class: 'sr-only'
= f.email_field :email, autofocus: true, autocomplete: 'email',

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
Rails.application.routes.draw do
devise_for :usuaries
devise_for :usuaries, controllers: { registrations: 'registrations' }
get '/.well-known/change-password', to: redirect('/usuaries/edit')
require 'que/web'