Add setting to disable new user registration on self-hosted instances #1163
Reference in New Issue
Block a user
Delete Branch "feat/add-seetings-to-control-registrations"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Close #1152
https://github.com/user-attachments/assets/ffac81c8-5d21-48c0-a11a-1a031a5ce95a
Awesome work, thanks for tackling this!
I know there are a ton of users looking for this feature so I think this one will be a super valuable addition!
Left a few suggestions on code organization, but everything works great!
@@ -0,0 +2,4 @@def index@invite_codes = InviteCode.allendMentioned this in a comment below, but I think we could break this controller into:
@@ -0,0 +1,28 @@import { Controller } from "@hotwired/stimulus"Remove?
Code looks good here, but can we move this to a
_invite_code.html.erbpartial, and then inindexwe can render a collection?@@ -80,1 +77,4 @@</div><div><%= link_to t(".smtp_settings.send_test_email_button"), send_test_email_settings_hosting_path, data: { turbo_method: :post }, class: "bg-gray-50 text-gray-900 text-sm font-medium rounded-lg px-3 py-2" %></div>If we make a slight modification to this, we can avoid the custom
respond_to. This would fetch the index frame and render it here:When we do this, we'll need to update the button above to make a post request to
invite_codes_pathto invoke a CREATE action.That way, we separate the responsibilities a bit better:
@justinfar a lot of users have been asking for a way to "restrict" signups on their self hosted instances, and since we already had these invite codes built into the system, I suggested to @tonyvince here in this comment a potential implementation, which he has implemented here in this PR. Think this will be a really helpful one to a lot of self hosters!
Pulling you in here to ask if there are any design tweaks you think we should make on this one before merging?
@@ -0,0 +2,4 @@def index@invite_codes = InviteCode.allenddee9af2
@@ -0,0 +1,28 @@import { Controller } from "@hotwired/stimulus"47f312d
@@ -80,1 +77,4 @@</div><div><%= link_to t(".smtp_settings.send_test_email_button"), send_test_email_settings_hosting_path, data: { turbo_method: :post }, class: "bg-gray-50 text-gray-900 text-sm font-medium rounded-lg px-3 py-2" %></div>68a069d
@tonyvince hey there! Thanks so much for working on this and for trying to stay as close to the design language as possible. I worked on this view for a bit and I rearranged some parts and tweaked some things visually (but still kept the same structure so you won't need to rewrite any logic).
I added a page (the title has the same # and title as this issue) in the Figma community file over here so that you can reference the design shown below.
Here's a prototype of how it should work.
https://github.com/user-attachments/assets/fd116722-213d-436a-b180-c2f0fe362847
@zachgoll the one only major tweak I've made is that I've split General Settings, SMTP Email Configuration and Invite Codes into seperate sections within the Self-Hosting settings page just to keep the different sections separate. You can see that in the first frame here. The changes there were:
text-lgWould it be an issue to include that change with this PR?
@tonyvince the code updates look good! Should be good to merge after the design tweaks are made.
@justinfar looks great to me!
Changed designs
https://github.com/user-attachments/assets/c028dcec-fd87-4369-939c-e5643bff7caa
Thanks for making the design changes @tonyvince!
Only small tweaks left to make if it's not an issue are:
text-sm24px@tonyvince this is ready for final review correct?
@@ -0,0 +1,16 @@<%# app/views/invite_codes/_invite_code.html.erb %>@@ -51,37 +50,75 @@<%= form.url_field :render_deploy_hook, label: t(".render_deploy_hook_label"), placeholder: t(".render_deploy_hook_placeholder"), value: Setting.render_deploy_hook, data: { "auto-submit-form-target" => "auto" } %>@tonyvince as I was doing a final review, I noticed that this POST request is happening inside the main form, which causes a nested form that we'll want to stay away from. This required a bit of reworking of this file, so rather than trying to make comments everywhere I made the tweaks locally. Here's the completed file—you may want to do a spot check on this since I put it together pretty quickly. The main changes are:
@@ -51,37 +50,75 @@<%= form.url_field :render_deploy_hook, label: t(".render_deploy_hook_label"), placeholder: t(".render_deploy_hook_placeholder"), value: Setting.render_deploy_hook, data: { "auto-submit-form-target" => "auto" } %>79fa4bd
@@ -51,37 +50,75 @@<%= form.url_field :render_deploy_hook, label: t(".render_deploy_hook_label"), placeholder: t(".render_deploy_hook_placeholder"), value: Setting.render_deploy_hook, data: { "auto-submit-form-target" => "auto" } %>I'm still seeing some layout and font sizing issues here. The code block above should have all of it in there so feel free to copy/paste.
@@ -0,0 +1,28 @@import { Controller } from "@hotwired/stimulus"@@ -51,37 +50,75 @@<%= form.url_field :render_deploy_hook, label: t(".render_deploy_hook_label"), placeholder: t(".render_deploy_hook_placeholder"), value: Setting.render_deploy_hook, data: { "auto-submit-form-target" => "auto" } %>Done
Nice work! I think we're good to merge this.
This will be a great addition for self hosters :)