Skip to content

Commit

Permalink
Add activate your account step 2 page
Browse files Browse the repository at this point in the history
  • Loading branch information
mlandauer committed Mar 6, 2024
1 parent a0a271a commit 691ae3e
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
47 changes: 47 additions & 0 deletions app/views/_tailwind/users/activations/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<%# TODO: This page needs a proper design %>
<%# TODO: Extract out component for this centred block %>
<div class="max-w-lg mx-auto">
<%# This is using a different style than the standard Heading component %>
<%= render Tailwind::Heading.new(tag: :h1, color: "fuchsia", extra_classes: "my-20 text-center").with_content("Activate your account") %>

<%= form_with model: @user, url: users_activation_path, method: :put, builder: FormBuilders::Tailwind do |f| %>
<%= f.hidden_field :reset_password_token %>

<div class="flex flex-col items-center">
<div class="w-full">
<%= f.label :name, "Your full name", class: "block" %>
<%= f.text_field :name, class: "mt-1 block w-full", autofocus: true, autocomplete: "name", placeholder: "e.g. Jane Citizen" %>
<%= f.error :name, class: "mt-2" %>
</div>

<div class="w-full mt-5">
<%= f.label :password, "Password", class: "block" %>
<%= f.password_field :password, class: "mt-1 block w-full", autocomplete: "new-password" %>
<%= f.error :password, class: "mt-2" %>
<% if @minimum_password_length %>
<p class="mt-2 text-2xl font-light text-navy"><%= @minimum_password_length %> characters minimum</p>
<% end %>
</div>

<div class="mt-8">
<%= f.button "Activate my account" %>
</div>
</div>
<% end %>
<div class="mt-10 text-2xl text-navy">
<%= render "privacy_policy" %>
</div>
</div>

<%
=begin
%>
<p class="login-explanation">
After you have activated your account you will be able to login using your
email and password.
</p>
<%
=end
%>
17 changes: 17 additions & 0 deletions spec/features/activate_account_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@
# rubocop:enable RSpec/NoExpectationExample
end

context "when on final activate your account page in the new design" do
before do
# Do this weird dance to get us on to the new theme
sign_in create(:confirmed_user, tailwind_theme: true)
visit root_path
sign_out :user
# Strictly this page needs a token to function but for the purposes of this we don't need to do that
visit edit_users_activation_path
end

# rubocop:disable RSpec/NoExpectationExample
it "renders the page", js: true do
page.percy_snapshot("Activate step 2")
end
# rubocop:enable RSpec/NoExpectationExample
end

context "with a confirmed user that has not been activated" do
before do
u = User.new(email: "[email protected]", from_alert_or_comment: true, confirmed_at: Time.zone.now)
Expand Down

0 comments on commit 691ae3e

Please sign in to comment.