Remove redeemable code

I don't think this feature it was ever used. It was introduced in commit
49dec6061 as part of a feature that was removed in commits 1cd47da9d and
c45a0bd8ac.
This commit is contained in:
Javi Martín
2025-03-13 02:45:01 +01:00
parent 6089a9249f
commit 5ba6e7b692
8 changed files with 9 additions and 39 deletions

View File

@@ -6,9 +6,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
invisible_captcha only: [:create], honeypot: :address, scope: :user
def new
super do |user|
user.use_redeemable_code = true if params[:use_redeemable_code].present?
end
super
end
def create
@@ -64,18 +62,13 @@ class Users::RegistrationsController < Devise::RegistrationsController
private
def sign_up_params
if params[:user].present? && params[:user][:redeemable_code].blank?
params[:user].delete(:redeemable_code)
end
params.require(:user).permit(allowed_params)
end
def allowed_params
[
:username, :email, :password,
:password_confirmation, :terms_of_service, :locale,
:redeemable_code
:password_confirmation, :terms_of_service, :locale
]
end

View File

@@ -89,7 +89,7 @@ class User < ApplicationRecord
accepts_nested_attributes_for :organization, update_only: true
attr_accessor :skip_password_validation, :use_redeemable_code, :login
attr_accessor :skip_password_validation, :login
scope :administrators, -> { joins(:administrator) }
scope :moderators, -> { joins(:moderator) }

View File

@@ -15,7 +15,6 @@
<div class="row">
<div class="small-12 column">
<%= f.hidden_field :use_redeemable_code %>
<%= f.hidden_field :locale, value: I18n.locale %>
<%= f.text_field :username, autofocus: true, maxlength: User.username_max_length,
@@ -30,10 +29,6 @@
<%= f.password_field :password_confirmation, autocomplete: "off",
label: t("devise_views.users.registrations.new.password_confirmation_label") %>
<% if resource.use_redeemable_code %>
<%= f.text_field :redeemable_code %>
<% end %>
<%= f.check_box :terms_of_service,
label: t("devise_views.users.registrations.new.terms",
terms: new_window_link_to(t("devise_views.users.registrations.new.terms_link"),