From 3f4d500103a37f739583503e01a721f8f01d3338 Mon Sep 17 00:00:00 2001 From: "Stanko K.R." Date: Wed, 5 Nov 2025 08:53:52 +0100 Subject: [PATCH 01/13] Unify sign in and sign up --- app/controllers/sessions_controller.rb | 19 ++++-- app/models/identity.rb | 2 +- .../app/controllers/concerns/restricted.rb | 11 ---- .../completions_controller.rb | 4 +- .../memberships_controller.rb | 4 +- .../app/controllers/signups_controller.rb | 33 ---------- gems/fizzy-saas/app/models/signup.rb | 6 -- .../completions/new.html.erb | 0 .../memberships/new.html.erb | 0 .../views/{signups => signup}/new.html.erb | 0 gems/fizzy-saas/config/routes.rb | 12 ++-- .../signups/completions_controller_test.rb | 13 ++-- .../signups/memberships_controller_test.rb | 15 ++--- .../controllers/signups_controller_test.rb | 54 --------------- gems/fizzy-saas/test/models/signup_test.rb | 6 +- test/controllers/sessions_controller_test.rb | 65 +++++++++++-------- 16 files changed, 71 insertions(+), 173 deletions(-) delete mode 100644 gems/fizzy-saas/app/controllers/concerns/restricted.rb rename gems/fizzy-saas/app/controllers/{signups => signup}/completions_controller.rb (85%) rename gems/fizzy-saas/app/controllers/{signups => signup}/memberships_controller.rb (87%) delete mode 100644 gems/fizzy-saas/app/controllers/signups_controller.rb rename gems/fizzy-saas/app/views/{signups => signup}/completions/new.html.erb (100%) rename gems/fizzy-saas/app/views/{signups => signup}/memberships/new.html.erb (100%) rename gems/fizzy-saas/app/views/{signups => signup}/new.html.erb (100%) delete mode 100644 gems/fizzy-saas/test/controllers/signups_controller_test.rb diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 5d93a4708..9c3a66731 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,4 +1,9 @@ class SessionsController < ApplicationController + # FIXME: Remove this before launch! + SIGNUP_USERNAME = Rails.env.test? ? "testname" : Rails.application.credentials.account_signup_http_basic_auth.name + SIGNUP_PASSWORD = Rails.env.test? ? "testpassword" : Rails.application.credentials.account_signup_http_basic_auth.password + http_basic_authenticate_with name: SIGNUP_USERNAME, password: SIGNUP_PASSWORD, realm: "Fizzy Signup", only: :create, unless: -> { Identity.exists?(email_address: email_address) } + require_untenanted_access require_unauthenticated_access except: :destroy rate_limit to: 10, within: 3.minutes, only: :create, with: -> { redirect_to new_session_path, alert: "Try again later." } @@ -9,11 +14,15 @@ class SessionsController < ApplicationController end def create - magic_link = Identity.find_by_email_address(email_address)&.send_magic_link - - flash[:magic_link_code] = magic_link&.code if Rails.env.development? - - redirect_to session_magic_link_path + if identity = Identity.find_by_email_address(email_address) + magic_link = identity.send_magic_link + flash[:magic_link_code] = magic_link&.code if Rails.env.development? + redirect_to session_magic_link_path + elsif defined?(Signup) && defined?(saas) + Signup.new(email_address: email_address).create_identity + session[:return_to_after_authenticating] = saas.new_signup_membership_path + redirect_to session_magic_link_path + end end def destroy diff --git a/app/models/identity.rb b/app/models/identity.rb index f5daf3be1..99c90271f 100644 --- a/app/models/identity.rb +++ b/app/models/identity.rb @@ -5,7 +5,7 @@ class Identity < UntenantedRecord has_many :magic_links, dependent: :destroy has_many :sessions, dependent: :destroy - normalizes :email_address, with: ->(value) { value.strip.downcase } + normalizes :email_address, with: ->(value) { value.strip.downcase.presence } def send_magic_link magic_links.create!.tap do |magic_link| diff --git a/gems/fizzy-saas/app/controllers/concerns/restricted.rb b/gems/fizzy-saas/app/controllers/concerns/restricted.rb deleted file mode 100644 index b117810ba..000000000 --- a/gems/fizzy-saas/app/controllers/concerns/restricted.rb +++ /dev/null @@ -1,11 +0,0 @@ -module Restricted - extend ActiveSupport::Concern - - included do - unless Rails.env.development? - http_basic_authenticate_with \ - name: Rails.env.test? ? "testname" : Rails.application.credentials.account_signup_http_basic_auth.name, - password: Rails.env.test? ? "testpassword" : Rails.application.credentials.account_signup_http_basic_auth.password - end - end -end diff --git a/gems/fizzy-saas/app/controllers/signups/completions_controller.rb b/gems/fizzy-saas/app/controllers/signup/completions_controller.rb similarity index 85% rename from gems/fizzy-saas/app/controllers/signups/completions_controller.rb rename to gems/fizzy-saas/app/controllers/signup/completions_controller.rb index 58dd528d2..5641ce418 100644 --- a/gems/fizzy-saas/app/controllers/signups/completions_controller.rb +++ b/gems/fizzy-saas/app/controllers/signup/completions_controller.rb @@ -1,6 +1,4 @@ -class Signups::CompletionsController < ApplicationController - include Restricted - +class Signup::CompletionsController < ApplicationController require_untenanted_access layout "public" diff --git a/gems/fizzy-saas/app/controllers/signups/memberships_controller.rb b/gems/fizzy-saas/app/controllers/signup/memberships_controller.rb similarity index 87% rename from gems/fizzy-saas/app/controllers/signups/memberships_controller.rb rename to gems/fizzy-saas/app/controllers/signup/memberships_controller.rb index c75b63950..799382d58 100644 --- a/gems/fizzy-saas/app/controllers/signups/memberships_controller.rb +++ b/gems/fizzy-saas/app/controllers/signup/memberships_controller.rb @@ -1,6 +1,4 @@ -class Signups::MembershipsController < ApplicationController - include Restricted - +class Signup::MembershipsController < ApplicationController require_untenanted_access layout "public" diff --git a/gems/fizzy-saas/app/controllers/signups_controller.rb b/gems/fizzy-saas/app/controllers/signups_controller.rb deleted file mode 100644 index 967a4b571..000000000 --- a/gems/fizzy-saas/app/controllers/signups_controller.rb +++ /dev/null @@ -1,33 +0,0 @@ -class SignupsController < ApplicationController - include Restricted - - require_untenanted_access - require_unauthenticated_access - - layout "public" - - rate_limit only: :create, name: "short-term", to: 5, within: 3.minutes, - with: -> { redirect_to saas.new_signup_path, alert: "Try again later." } - rate_limit only: :create, name: "long-term", to: 10, within: 30.minutes, - with: -> { redirect_to saas.new_signup_path, alert: "Try again later." } - - def new - @signup = Signup.new - end - - def create - @signup = Signup.new(signup_params) - - if @signup.create_identity - session[:return_to_after_authenticating] = saas.new_signup_membership_path - redirect_to session_magic_link_path - else - render :new, status: :unprocessable_entity - end - end - - private - def signup_params - params.expect(signup: %i[ email_address ]) - end -end diff --git a/gems/fizzy-saas/app/models/signup.rb b/gems/fizzy-saas/app/models/signup.rb index ed9b94528..b03ce730a 100644 --- a/gems/fizzy-saas/app/models/signup.rb +++ b/gems/fizzy-saas/app/models/signup.rb @@ -8,10 +8,6 @@ class Signup attr_accessor :full_name, :email_address, :identity, :membership_id, :account_name attr_reader :queenbee_account, :account, :user, :tenant, :membership - with_options on: :identity_creation do - validates_presence_of :email_address - end - with_options on: :membership_creation do validates_presence_of :full_name, :identity end @@ -42,8 +38,6 @@ class Signup end def create_identity - return false unless valid?(:identity_creation) - @identity = Identity.find_or_create_by!(email_address: email_address) @identity.send_magic_link end diff --git a/gems/fizzy-saas/app/views/signups/completions/new.html.erb b/gems/fizzy-saas/app/views/signup/completions/new.html.erb similarity index 100% rename from gems/fizzy-saas/app/views/signups/completions/new.html.erb rename to gems/fizzy-saas/app/views/signup/completions/new.html.erb diff --git a/gems/fizzy-saas/app/views/signups/memberships/new.html.erb b/gems/fizzy-saas/app/views/signup/memberships/new.html.erb similarity index 100% rename from gems/fizzy-saas/app/views/signups/memberships/new.html.erb rename to gems/fizzy-saas/app/views/signup/memberships/new.html.erb diff --git a/gems/fizzy-saas/app/views/signups/new.html.erb b/gems/fizzy-saas/app/views/signup/new.html.erb similarity index 100% rename from gems/fizzy-saas/app/views/signups/new.html.erb rename to gems/fizzy-saas/app/views/signup/new.html.erb diff --git a/gems/fizzy-saas/config/routes.rb b/gems/fizzy-saas/config/routes.rb index 04f8faca9..b99f172ff 100644 --- a/gems/fizzy-saas/config/routes.rb +++ b/gems/fizzy-saas/config/routes.rb @@ -1,11 +1,9 @@ Fizzy::Saas::Engine.routes.draw do - resource :signup, only: %i[ new create ] do - scope module: :signups, as: :signup do - collection do - resource :membership, only: %i[ new create ] - resource :completion, only: %i[ new create ] - end - end + get "/signup/new", to: redirect("/session/new") + + namespace :signup do + resource :membership, only: %i[ new create ] + resource :completion, only: %i[ new create ] end Queenbee.routes(self) diff --git a/gems/fizzy-saas/test/controllers/signups/completions_controller_test.rb b/gems/fizzy-saas/test/controllers/signups/completions_controller_test.rb index 35861722d..aa18721fd 100644 --- a/gems/fizzy-saas/test/controllers/signups/completions_controller_test.rb +++ b/gems/fizzy-saas/test/controllers/signups/completions_controller_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class Signups::CompletionsControllerTest < ActionDispatch::IntegrationTest +class Signup::CompletionsControllerTest < ActionDispatch::IntegrationTest setup do @signup = Signup.new(email_address: "newuser@example.com", full_name: "New User") @@ -16,7 +16,7 @@ class Signups::CompletionsControllerTest < ActionDispatch::IntegrationTest get saas.new_signup_completion_path(signup: { membership_id: @signup.membership_id, full_name: @signup.full_name, - account_name: @signup.account_name }), headers: http_basic_auth_headers + account_name: @signup.account_name }) end assert_response :success @@ -30,7 +30,7 @@ class Signups::CompletionsControllerTest < ActionDispatch::IntegrationTest full_name: @signup.full_name, account_name: @signup.account_name } - }, headers: http_basic_auth_headers + } end assert_redirected_to landing_path(script_name: "/#{@signup.tenant}"), "Successful completion should redirect to root in new tenant" @@ -42,14 +42,9 @@ class Signups::CompletionsControllerTest < ActionDispatch::IntegrationTest full_name: "", account_name: "" } - }, headers: http_basic_auth_headers + } end assert_response :unprocessable_entity, "Invalid params should return unprocessable entity" end - - private - def http_basic_auth_headers - { "Authorization" => ActionController::HttpAuthentication::Basic.encode_credentials("testname", "testpassword") } - end end diff --git a/gems/fizzy-saas/test/controllers/signups/memberships_controller_test.rb b/gems/fizzy-saas/test/controllers/signups/memberships_controller_test.rb index f1ca13093..57010d2bd 100644 --- a/gems/fizzy-saas/test/controllers/signups/memberships_controller_test.rb +++ b/gems/fizzy-saas/test/controllers/signups/memberships_controller_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class Signups::MembershipsControllerTest < ActionDispatch::IntegrationTest +class Signup::MembershipsControllerTest < ActionDispatch::IntegrationTest setup do @identity = Identity.create!(email_address: "newuser@example.com") magic_link = @identity.send_magic_link @@ -16,7 +16,7 @@ class Signups::MembershipsControllerTest < ActionDispatch::IntegrationTest test "new" do untenanted do - get saas.new_signup_membership_path, headers: http_basic_auth_headers + get saas.new_signup_membership_path assert_response :success end @@ -24,7 +24,7 @@ class Signups::MembershipsControllerTest < ActionDispatch::IntegrationTest test "new with new_user param" do untenanted do - get saas.new_signup_membership_path(signup: { new_user: true }), headers: http_basic_auth_headers + get saas.new_signup_membership_path(signup: { new_user: true }) assert_response :success end @@ -37,7 +37,7 @@ class Signups::MembershipsControllerTest < ActionDispatch::IntegrationTest signup: { full_name: "New User" } - }, headers: http_basic_auth_headers + } end membership = Membership.last @@ -58,15 +58,10 @@ class Signups::MembershipsControllerTest < ActionDispatch::IntegrationTest signup: { full_name: "" } - }, headers: http_basic_auth_headers + } end assert_response :unprocessable_entity, "Invalid params should return unprocessable entity" end end - - private - def http_basic_auth_headers - { "Authorization" => ActionController::HttpAuthentication::Basic.encode_credentials("testname", "testpassword") } - end end diff --git a/gems/fizzy-saas/test/controllers/signups_controller_test.rb b/gems/fizzy-saas/test/controllers/signups_controller_test.rb deleted file mode 100644 index afb773031..000000000 --- a/gems/fizzy-saas/test/controllers/signups_controller_test.rb +++ /dev/null @@ -1,54 +0,0 @@ -require "test_helper" - -class SignupsControllerTest < ActionDispatch::IntegrationTest - setup do - @signup_params = { - full_name: "Brian Wilson", - email_address: "brian@example.com", - company_name: "Beach Boys" - } - @starting_tenants = ApplicationRecord.tenants - - # Clear script_name for untenanted signup tests - integration_session.default_url_options[:script_name] = nil - end - - test "should require http basic authentication" do - get saas.new_signup_url - - assert_response :unauthorized - end - - test "should get new" do - get saas.new_signup_url, headers: http_basic_auth_headers - - assert_response :success - assert_select "h1", "Sign up" - assert_select "input[name='signup[email_address]']" - end - - test "should create signup and redirect to magic link page" do - assert_no_difference -> { ApplicationRecord.tenants.count } do - post saas.signup_url, params: { signup: { email_address: @signup_params[:email_address] } }, headers: http_basic_auth_headers - end - - assert_redirected_to session_magic_link_path - end - - test "should render new with errors when signup fails validation" do - invalid_params = { email_address: "" } - - assert_no_difference -> { ApplicationRecord.tenants.count } do - post saas.signup_url, params: { signup: invalid_params }, headers: http_basic_auth_headers - end - - assert_response :unprocessable_entity - assert_select ".txt-negative" - end - - private - def http_basic_auth_headers - credentials = ActionController::HttpAuthentication::Basic.encode_credentials("testname", "testpassword") - { "HTTP_AUTHORIZATION" => credentials } - end -end diff --git a/gems/fizzy-saas/test/models/signup_test.rb b/gems/fizzy-saas/test/models/signup_test.rb index 685b25b38..e5364c141 100644 --- a/gems/fizzy-saas/test/models/signup_test.rb +++ b/gems/fizzy-saas/test/models/signup_test.rb @@ -27,8 +27,9 @@ class SignupTest < ActiveSupport::TestCase end signup_invalid = Signup.new(email_address: "") - assert_not signup_invalid.create_identity, "Should fail with invalid email" - assert_not_empty signup_invalid.errors[:email_address], "Should have validation error for email_address" + assert_raises do + signup_invalid.create_identity + end end test "#create_membership" do @@ -56,7 +57,6 @@ class SignupTest < ActiveSupport::TestCase test "#complete" do Account.any_instance.expects(:setup_customer_template).once - # First create the membership signup_for_membership = Signup.new( full_name: "Kevin", identity: identities(:kevin) diff --git a/test/controllers/sessions_controller_test.rb b/test/controllers/sessions_controller_test.rb index 2923734b7..83f0438b5 100644 --- a/test/controllers/sessions_controller_test.rb +++ b/test/controllers/sessions_controller_test.rb @@ -1,10 +1,42 @@ require "test_helper" class SessionsControllerTest < ActionDispatch::IntegrationTest - test "destroy" do + test "new" do untenanted do - sign_in_as :kevin + get new_session_path + end + assert_response :success + end + + test "create" do + identity = identities(:kevin) + + untenanted do + assert_difference -> { MagicLink.count }, 1 do + post session_path, params: { email_address: identity.email_address } + end + + assert_redirected_to session_magic_link_path + end + end + + test "create for a new user" do + untenanted do + assert_difference -> { Identity.count }, +1 do + assert_difference -> { MagicLink.count }, +1 do + post session_path, params: { email_address: "nonexistent@example.com" }, headers: http_basic_auth_headers("testname", "testpassword") + end + end + + assert_redirected_to session_magic_link_path + end + end + + test "destroy" do + sign_in_as :kevin + + untenanted do delete session_path assert_redirected_to new_session_path @@ -12,31 +44,8 @@ class SessionsControllerTest < ActionDispatch::IntegrationTest end end - test "new" do - untenanted do - get new_session_path - - assert_response :success + private + def http_basic_auth_headers(user, password) + { "Authorization" => ActionController::HttpAuthentication::Basic.encode_credentials(user, password) } end - end - - test "create" do - untenanted do - identity = identities(:kevin) - - assert_difference -> { MagicLink.count }, 1 do - post session_path, params: { email_address: identity.email_address } - end - - assert_redirected_to session_magic_link_path - end - - untenanted do - assert_no_difference -> { MagicLink.count } do - post session_path, params: { email_address: "nonexistent@example.com" } - end - - assert_redirected_to session_magic_link_path - end - end end From 7a58c23e55f3bb7196b323817b80c606a1c521cc Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Wed, 5 Nov 2025 13:05:34 -0600 Subject: [PATCH 02/13] Copy edits for unified flow --- app/controllers/join_codes_controller.rb | 2 ++ app/controllers/users/joins_controller.rb | 2 ++ app/mailers/magic_link_mailer.rb | 2 +- app/views/join_codes/new.html.erb | 11 +++-------- app/views/layouts/mailer.html.erb | 2 +- .../email_change_confirmation.html.erb | 3 +-- .../sign_in_instructions.html.erb | 7 +++---- .../sign_in_instructions.text.erb | 6 ++---- .../memberships/email_addresses/new.html.erb | 6 +++--- app/views/sessions/magic_links/show.html.erb | 2 +- app/views/sessions/new.html.erb | 2 +- app/views/users/joins/new.html.erb | 15 ++++----------- .../app/views/signup/memberships/new.html.erb | 8 ++++---- 13 files changed, 28 insertions(+), 40 deletions(-) diff --git a/app/controllers/join_codes_controller.rb b/app/controllers/join_codes_controller.rb index 6a13bef2f..a4b6768b9 100644 --- a/app/controllers/join_codes_controller.rb +++ b/app/controllers/join_codes_controller.rb @@ -4,6 +4,8 @@ class JoinCodesController < ApplicationController before_action :set_join_code before_action :ensure_join_code_is_valid + layout "public" + def new @account_name = ApplicationRecord.with_tenant(tenant) { Account.sole.name } end diff --git a/app/controllers/users/joins_controller.rb b/app/controllers/users/joins_controller.rb index d811a6203..73a9ae296 100644 --- a/app/controllers/users/joins_controller.rb +++ b/app/controllers/users/joins_controller.rb @@ -3,6 +3,8 @@ class Users::JoinsController < ApplicationController before_action :set_join_code, :ensure_join_code_is_valid + layout "public" + def new end diff --git a/app/mailers/magic_link_mailer.rb b/app/mailers/magic_link_mailer.rb index 391e64f6d..c56872f4a 100644 --- a/app/mailers/magic_link_mailer.rb +++ b/app/mailers/magic_link_mailer.rb @@ -3,7 +3,7 @@ class MagicLinkMailer < ApplicationMailer @magic_link = magic_link @identity = @magic_link.identity - mail to: @identity.email_address, subject: "Sign in to Fizzy" + mail to: @identity.email_address, subject: "Confirm your email" end private diff --git a/app/views/join_codes/new.html.erb b/app/views/join_codes/new.html.erb index 5974c16ba..c4d933b8b 100644 --- a/app/views/join_codes/new.html.erb +++ b/app/views/join_codes/new.html.erb @@ -1,12 +1,7 @@ -<% @page_title = "Join #{@account_name}" %> +<% @page_title = "Join #{@account_name} in Fizzy" %>
-
-

- <%= @page_title %> -

-

Enter your email address to continue

-
+

<%= @page_title %>

<%= form_with url: join_path(code: params[:code], tenant: params[:tenant]), class: "flex flex-column gap txt-medium", data: { controller: "form" } do |form| %>
@@ -16,7 +11,7 @@
<% end %> diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index 5e3c6e69f..564fe55b2 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -63,7 +63,7 @@ background: #2d71e5; border-color: #2d71e5; border-radius: 3rem; - color: #ffffff; + color: #ffffff !important; font-weight: 500; padding: 0.5em 1em; text-decoration: none; diff --git a/app/views/mailers/identity_mailer/email_change_confirmation.html.erb b/app/views/mailers/identity_mailer/email_change_confirmation.html.erb index 438dc18e9..dd55d602e 100644 --- a/app/views/mailers/identity_mailer/email_change_confirmation.html.erb +++ b/app/views/mailers/identity_mailer/email_change_confirmation.html.erb @@ -1,5 +1,4 @@ -

Confirm your email address change

-

Hit the button below to use this email address in Fizzy.

+

Confirm your email address change

<%= link_to "Yes use use this email address", email_address_confirmation_url(membership_id: @membership.id, email_address_token: @token), class: "btn" %> diff --git a/app/views/mailers/magic_link_mailer/sign_in_instructions.html.erb b/app/views/mailers/magic_link_mailer/sign_in_instructions.html.erb index b966ecfa6..6033b6165 100644 --- a/app/views/mailers/magic_link_mailer/sign_in_instructions.html.erb +++ b/app/views/mailers/magic_link_mailer/sign_in_instructions.html.erb @@ -1,9 +1,8 @@ -

Sign in to Fizzy

-

Hit the button below to sign in to Fizzy on this device

+

Hit the button below to confirm your email.

-<%= link_to "Sign in to Fizzy", session_magic_link_url(code: @magic_link.code), class: "btn" %> +<%= link_to "Confirm and return to Fizzy", session_magic_link_url(code: @magic_link.code), class: "btn" %> -

If you’re signing in on another device, enter this special code: +

If Fizzy is on another device, enter this special code instead:
<%= @magic_link.code %>

diff --git a/app/views/mailers/magic_link_mailer/sign_in_instructions.text.erb b/app/views/mailers/magic_link_mailer/sign_in_instructions.text.erb index f44e1c908..215508029 100644 --- a/app/views/mailers/magic_link_mailer/sign_in_instructions.text.erb +++ b/app/views/mailers/magic_link_mailer/sign_in_instructions.text.erb @@ -1,8 +1,6 @@ -Sign in to Fizzy -<%= "=" * 80 %> +Hit the button below to confirm your email: -Open this link in your browser to login on this device: <%= session_magic_link_url(code: @magic_link.code) %> -If you're signing in on another device, enter this code: +If Fizzy is on another device, enter this special code instead: <%= @magic_link.code %> diff --git a/app/views/memberships/email_addresses/new.html.erb b/app/views/memberships/email_addresses/new.html.erb index f88456679..e99596471 100644 --- a/app/views/memberships/email_addresses/new.html.erb +++ b/app/views/memberships/email_addresses/new.html.erb @@ -13,7 +13,7 @@

<%= @page_title %>

-

Enter your new email address. We'll send you a confirmation to verify it.

+

Enter your new email address, then hit the link to confirm it

<%= form_with url: email_addresses_path(membership_id: @membership.id), method: :post, class: "flex flex-column gap", data: { controller: "form", turbo: false } do |form| %> @@ -23,8 +23,8 @@
- <% end %> diff --git a/app/views/sessions/magic_links/show.html.erb b/app/views/sessions/magic_links/show.html.erb index 7af4e6e20..445b3233a 100644 --- a/app/views/sessions/magic_links/show.html.erb +++ b/app/views/sessions/magic_links/show.html.erb @@ -3,7 +3,7 @@
">

<%= @page_title %>

-

We just emailed you a link to sign in.

+

Then hit the link to continue

If your email is on a different device, enter the code included in the email below.

diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index be35c17b1..eb47bfe4f 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -1,4 +1,4 @@ -<% @page_title = "Sign in" %> +<% @page_title = "Enter your email" %>

<%= @page_title %>

diff --git a/app/views/users/joins/new.html.erb b/app/views/users/joins/new.html.erb index adf795ece..a5601b7a7 100644 --- a/app/views/users/joins/new.html.erb +++ b/app/views/users/joins/new.html.erb @@ -1,24 +1,17 @@ -<% @page_title = "Join #{Account.sole.name}" %> +<% @page_title = "Great! Now enter your name" %>
-
-

- <%= @page_title %> -

- -

Enter your name to continue

-
+

<%= @page_title %>

<%= form_with scope: "user", url: users_joins_path(membership: params[:membership]), class: "flex flex-column gap txt-medium", data: { controller: "form" } do |form| %>
<% end %> diff --git a/gems/fizzy-saas/app/views/signup/memberships/new.html.erb b/gems/fizzy-saas/app/views/signup/memberships/new.html.erb index 416e9d8f2..97f253266 100644 --- a/gems/fizzy-saas/app/views/signup/memberships/new.html.erb +++ b/gems/fizzy-saas/app/views/signup/memberships/new.html.erb @@ -1,12 +1,12 @@ -<% @page_title = "Create your account" %> +<% @page_title = "Create your new Fizzy account" %> -
"> -

<%= @page_title %>

+
"> +

<%= @page_title %>

<%= form_with model: @signup, url: saas.signup_membership_path, scope: "signup", class: "flex flex-column gap", data: { controller: "form" } do |form| %> <%= form.hidden_field :new_user %> - <%= form.text_field :full_name, class: "input", autocomplete: "name", placeholder: "Your name", autofocus: true, required: true %> + <%= form.text_field :full_name, class: "input", autocomplete: "name", placeholder: "Full name", autofocus: true, required: true %> <% if @signup.errors.any? %>
From 08a7db935a30eb2a5152b6c3ca5d62a497f5d1dc Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Wed, 5 Nov 2025 13:17:30 -0600 Subject: [PATCH 03/13] Fix mailer preview --- .../previews/identity_mailer_preview.rb | 17 +++++++++++++++++ test/mailers/previews/user_mailer_preview.rb | 18 ------------------ 2 files changed, 17 insertions(+), 18 deletions(-) create mode 100644 test/mailers/previews/identity_mailer_preview.rb delete mode 100644 test/mailers/previews/user_mailer_preview.rb diff --git a/test/mailers/previews/identity_mailer_preview.rb b/test/mailers/previews/identity_mailer_preview.rb new file mode 100644 index 000000000..8d29667bc --- /dev/null +++ b/test/mailers/previews/identity_mailer_preview.rb @@ -0,0 +1,17 @@ +class IdentityMailerPreview < ActionMailer::Preview + def email_change_confirmation + ApplicationRecord.current_tenant = "897362094" + + identity = Identity.find_by(email_address: "david@37signals.com") + membership = identity&.memberships&.find_by(tenant: ApplicationRecord.current_tenant) + + new_email_address = "david.new@example.com" + token = membership.send(:generate_email_address_change_token, to: new_email_address) + + IdentityMailer.email_change_confirmation( + email_address: new_email_address, + token: token, + membership: membership + ) + end +end diff --git a/test/mailers/previews/user_mailer_preview.rb b/test/mailers/previews/user_mailer_preview.rb deleted file mode 100644 index d36b8929b..000000000 --- a/test/mailers/previews/user_mailer_preview.rb +++ /dev/null @@ -1,18 +0,0 @@ -class UserMailerPreview < ActionMailer::Preview - def email_change_confirmation - ApplicationRecord.current_tenant = "897362094" - user = User.find_by(email_address: "david@37signals.com") || User.new( - name: "David", - email_address: "david@37signals.com" - ) - - new_email_address = "david.new@example.com" - token = user.generate_email_address_change_token(to: new_email_address) - - UserMailer.email_change_confirmation( - user: user, - email_address: new_email_address, - token: token - ) - end -end From d18c9d38670248b9cf977ed9c71e3c3f747d2a1b Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Wed, 5 Nov 2025 13:20:28 -0600 Subject: [PATCH 04/13] No longer used --- app/mailers/user_mailer.rb | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 app/mailers/user_mailer.rb diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb deleted file mode 100644 index 09926c09b..000000000 --- a/app/mailers/user_mailer.rb +++ /dev/null @@ -1,8 +0,0 @@ -class UserMailer < ApplicationMailer - def email_change_confirmation(user:, email_address:, token:) - @user = user - @token = token - - mail to: email_address, subject: "Confirm your new email address" - end -end From db764836e49797893c618c0134bf731553571e20 Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Wed, 5 Nov 2025 13:21:38 -0600 Subject: [PATCH 05/13] Update test to match copy changes --- test/mailers/magic_link_mailer_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/mailers/magic_link_mailer_test.rb b/test/mailers/magic_link_mailer_test.rb index ee3d56abc..0c0dce2b6 100644 --- a/test/mailers/magic_link_mailer_test.rb +++ b/test/mailers/magic_link_mailer_test.rb @@ -10,7 +10,7 @@ class MagicLinkMailerTest < ActionMailer::TestCase end assert_equal [ "kevin@37signals.com" ], email.to - assert_equal "Sign in to Fizzy", email.subject + assert_equal "Confirm your email", email.subject assert_match magic_link.code, email.body.encoded end end From 3a21e0ed82d0bca00a6160495f24d42073e5cb5b Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Wed, 5 Nov 2025 17:18:37 -0600 Subject: [PATCH 06/13] Stronger logo presence (bigger) --- app/views/layouts/public.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/public.html.erb b/app/views/layouts/public.html.erb index 1373a87d5..6dbd5d61f 100644 --- a/app/views/layouts/public.html.erb +++ b/app/views/layouts/public.html.erb @@ -6,9 +6,9 @@