mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-21 23:06:22 +00:00
parent
f29bd2482e
commit
ec8ea41da5
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,
|
||||
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',
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue