1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 07:39:39 +02:00

Add setting to disable new user registration on self-hosted instances (#1163)

* Add clipboard stimulus controller

* Add invite codes controller

* Setting to force invite code for new signups

* Fix erb linter

* Normalize keys

* Add POST /invite_codes

* Cleanup clipboard_controller.js

* Create invite codes on-demand

* Design changes

* Style alignment

* Update app/views/invite_codes/_invite_code.html.erb

Co-authored-by: Zach Gollwitzer <zach.gollwitzer@gmail.com>
Signed-off-by: Tony Vincent <tonyvince7@gmail.com>

* Update app/views/invite_codes/_invite_code.html.erb

Co-authored-by: Zach Gollwitzer <zach.gollwitzer@gmail.com>
Signed-off-by: Tony Vincent <tonyvince7@gmail.com>

* Split into individual forms

* Fix missing styles

* Update app/javascript/controllers/clipboard_controller.js

Co-authored-by: Zach Gollwitzer <zach.gollwitzer@gmail.com>
Signed-off-by: Tony Vincent <tonyvince7@gmail.com>

* Fix test

---------

Signed-off-by: Tony Vincent <tonyvince7@gmail.com>
Co-authored-by: Zach Gollwitzer <zach.gollwitzer@gmail.com>
This commit is contained in:
Tony Vincent 2024-09-11 19:04:39 +02:00 committed by GitHub
parent 5178928b68
commit edf44bec03
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 197 additions and 62 deletions

View file

@ -31,6 +31,21 @@ class SettingsTest < ApplicationSystemTestCase
end
end
test "can update self hosting settings" do
Rails.application.config.app_mode.stubs(:self_hosted?).returns(true)
open_settings_from_sidebar
assert_selector "li", text: "Self hosting"
click_link "Self hosting"
assert_current_path settings_hosting_path
assert_selector "h1", text: "Self-Hosting"
check "setting_require_invite_for_signup", allow_label_click: true
click_button "Generate new code"
assert_selector 'span[data-clipboard-target="source"]', visible: true, count: 1 # invite code copy widget
copy_button = find('button[data-action="clipboard#copy"]', match: :first) # Find the first copy button (adjust if needed)
copy_button.click
assert_selector 'span[data-clipboard-target="iconSuccess"]', visible: true, count: 1 # text copied and icon changed to checkmark
end
private
def open_settings_from_sidebar