Forem creator feature flag + onboarding signup form (#11031)
* Add initial forem creator signup form * Fix label typos in various stylesheets :)
This commit is contained in:
parent
b9ce3c2a8b
commit
d008f89399
10 changed files with 88 additions and 9 deletions
|
|
@ -172,7 +172,7 @@
|
|||
--form-border-focus: var(--accent-brand);
|
||||
--form-placeholder-color: var(--base-60);
|
||||
|
||||
// Form lables
|
||||
// Form labels
|
||||
--label-primary: var(--base-90);
|
||||
--label-secondary: var(--base-60);
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@
|
|||
--form-border-focus: var(--accent-brand);
|
||||
--form-placeholder-color: var(--base-60);
|
||||
|
||||
// Form lables
|
||||
// Form labels
|
||||
--label-primary: var(--accent-brand);
|
||||
--label-secondary: var(--accent-brand-darker);
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@
|
|||
--form-border-focus: var(--accent-brand);
|
||||
--form-placeholder-color: var(--base-60);
|
||||
|
||||
// Form lables
|
||||
// Form labels
|
||||
--label-primary: var(--base-90);
|
||||
--label-secondary: var(--base-60);
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@
|
|||
--form-border-focus: var(--accent-brand);
|
||||
--form-placeholder-color: var(--base-60);
|
||||
|
||||
// Form lables
|
||||
// Form labels
|
||||
--label-primary: var(--base-90);
|
||||
--label-secondary: var(--base-60);
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@
|
|||
--form-border-focus: var(--base-60);
|
||||
--form-placeholder-color: var(--base-60);
|
||||
|
||||
// Form lables
|
||||
// Form labels
|
||||
--label-primary: var(--base-100);
|
||||
--label-secondary: var(--base-90);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,4 +24,12 @@ module AuthenticationHelper
|
|||
SiteConfig.recaptcha_site_key.present? &&
|
||||
SiteConfig.require_captcha_for_email_password_registration
|
||||
end
|
||||
|
||||
def forem_creator_flow_enabled?
|
||||
Flipper.enabled?(:creator_onboarding) && waiting_on_first_user?
|
||||
end
|
||||
|
||||
def waiting_on_first_user?
|
||||
SiteConfig.waiting_on_first_user
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@
|
|||
<div class="crayons-notice crayons-notice--danger mb-10 mt-8 mx-auto" style="width: 680px;max-width:94%;">
|
||||
Email authentication is not enabled for this Forem.
|
||||
</div>
|
||||
<% elsif SiteConfig.waiting_on_first_user %>
|
||||
<% elsif forem_creator_flow_enabled? %>
|
||||
<%= render "shared/authentication/forem_creator_signup" %>
|
||||
<% elsif waiting_on_first_user? %>
|
||||
<%# TODO: Vaidehi Joshi - Delete this view once forem creator onboarding is shipped %>
|
||||
<%= render "shared/authentication/initial_account_wizard" %>
|
||||
<% else %>
|
||||
<%= render "devise/shared/authorization_error" %>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<% elsif forem_creator_flow_enabled? %>
|
||||
<%# TODO: Vaidehi Joshi - Extract this into its own form %>
|
||||
<div class="align-center">
|
||||
<p class="pb-4 fw-bold">Almost there!</p>
|
||||
<p class="registration__description">Let's create an admin account for your community.</p>
|
||||
</div>
|
||||
<% else %>
|
||||
<p class="pb-4 fw-bold">Create your account</p>
|
||||
<% end %>
|
||||
|
|
@ -69,8 +75,16 @@
|
|||
<%= recaptcha_tags site_key: SiteConfig.recaptcha_site_key %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="actions pt-3">
|
||||
<%= f.submit "Sign up", class: "crayons-btn" %>
|
||||
</div>
|
||||
|
||||
<% if forem_creator_flow_enabled? %>
|
||||
<%# TODO: Vaidehi Joshi - Extract this into its own form %>
|
||||
<div class="flex flex-col pt-3">
|
||||
<%= f.submit "Create admin account", class: "crayons-btn" %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="actions pt-3">
|
||||
<%= f.submit "Sign up", class: "crayons-btn" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
<div class="mx-auto mt-8 mb-10 p-4 fs-2xl lh-base align-center" style="width:96%;max-width:1300px;">
|
||||
<%= render "shared/authentication/email_registration_form" %>
|
||||
</div>
|
||||
|
|
@ -109,6 +109,24 @@ RSpec.describe "Registrations", type: :request do
|
|||
expect(response).to redirect_to("/?signin=true")
|
||||
end
|
||||
end
|
||||
|
||||
context "with the creator_onboarding feature flag" do
|
||||
before do
|
||||
Flipper.enable(:creator_onboarding)
|
||||
SiteConfig.waiting_on_first_user = true
|
||||
end
|
||||
|
||||
after do
|
||||
Flipper.disable(:creator_onboarding)
|
||||
SiteConfig.waiting_on_first_user = false
|
||||
end
|
||||
|
||||
it "renders the creator onboarding form" do
|
||||
get new_user_registration_path
|
||||
expect(response.body).to include("Let's create an admin account for your community.")
|
||||
expect(response.body).to include("Create admin account")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET /users/signup" do
|
||||
|
|
@ -306,5 +324,38 @@ RSpec.describe "Registrations", type: :request do
|
|||
end.to raise_error Pundit::NotAuthorizedError
|
||||
end
|
||||
end
|
||||
|
||||
context "with the creator_onboarding feature flag" do
|
||||
before do
|
||||
Flipper.enable(:creator_onboarding)
|
||||
SiteConfig.waiting_on_first_user = true
|
||||
end
|
||||
|
||||
after do
|
||||
Flipper.disable(:creator_onboarding)
|
||||
SiteConfig.waiting_on_first_user = false
|
||||
end
|
||||
|
||||
it "creates user with valid params passed" do
|
||||
post "/users", params:
|
||||
{ user: { name: "test #{rand(10)}",
|
||||
username: "haha_#{rand(10)}",
|
||||
email: "yoooo#{rand(100)}@yo.co",
|
||||
password: "PaSSw0rd_yo000",
|
||||
password_confirmation: "PaSSw0rd_yo000" } }
|
||||
expect(User.all.size).to be 1
|
||||
end
|
||||
|
||||
it "makes user super admin and config admin" do
|
||||
post "/users", params:
|
||||
{ user: { name: "test #{rand(10)}",
|
||||
username: "haha_#{rand(10)}",
|
||||
email: "yoooo#{rand(100)}@yo.co",
|
||||
password: "PaSSw0rd_yo000",
|
||||
password_confirmation: "PaSSw0rd_yo000" } }
|
||||
expect(User.first.has_role?(:super_admin)).to be true
|
||||
expect(User.first.has_role?(:single_resource_admin, Config)).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue