Merge tag 'v2.8.2'
This commit is contained in:
commit
fc50cffd44
727 changed files with 27044 additions and 9474 deletions
|
|
@ -10,6 +10,10 @@ class Auth::RegistrationsController < Devise::RegistrationsController
|
|||
before_action :set_instance_presenter, only: [:new, :create, :update]
|
||||
before_action :set_body_classes, only: [:new, :create, :edit, :update]
|
||||
|
||||
def new
|
||||
super(&:build_invite_request)
|
||||
end
|
||||
|
||||
def destroy
|
||||
not_found
|
||||
end
|
||||
|
|
@ -24,9 +28,10 @@ class Auth::RegistrationsController < Devise::RegistrationsController
|
|||
def build_resource(hash = nil)
|
||||
super(hash)
|
||||
|
||||
resource.locale = I18n.locale
|
||||
resource.invite_code = params[:invite_code] if resource.invite_code.blank?
|
||||
resource.agreement = true
|
||||
resource.locale = I18n.locale
|
||||
resource.invite_code = params[:invite_code] if resource.invite_code.blank?
|
||||
resource.agreement = true
|
||||
resource.current_sign_in_ip = request.remote_ip
|
||||
|
||||
resource.current_sign_in_ip = request.remote_ip if resource.current_sign_in_ip.nil?
|
||||
resource.build_account if resource.account.nil?
|
||||
|
|
@ -34,7 +39,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController
|
|||
|
||||
def configure_sign_up_params
|
||||
devise_parameter_sanitizer.permit(:sign_up) do |u|
|
||||
u.permit({ account_attributes: [:username] }, :email, :password, :password_confirmation, :invite_code)
|
||||
u.permit({ account_attributes: [:username], invite_request_attributes: [:text] }, :email, :password, :password_confirmation, :invite_code)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -65,7 +70,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController
|
|||
end
|
||||
|
||||
def allowed_registrations?
|
||||
Setting.open_registrations || @invite&.valid_for_use?
|
||||
Setting.registrations_mode != 'none' || @invite&.valid_for_use?
|
||||
end
|
||||
|
||||
def invite_code
|
||||
|
|
@ -87,7 +92,8 @@ class Auth::RegistrationsController < Devise::RegistrationsController
|
|||
end
|
||||
|
||||
def set_invite
|
||||
@invite = invite_code.present? ? Invite.find_by(code: invite_code) : nil
|
||||
invite = invite_code.present? ? Invite.find_by(code: invite_code) : nil
|
||||
@invite = invite&.valid_for_use? ? invite : nil
|
||||
end
|
||||
|
||||
def determine_layout
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue