-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11167 from 18F/stages/rc-2024-08-29
Deploy RC 410 to Production
- Loading branch information
Showing
84 changed files
with
1,743 additions
and
359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# frozen_string_literal: true | ||
|
||
module SignUp | ||
class SelectEmailController < ApplicationController | ||
before_action :confirm_two_factor_authenticated | ||
before_action :verify_needs_completions_screen | ||
|
||
def show | ||
@sp_name = current_sp.friendly_name || sp.agency&.name | ||
@user_emails = user_emails | ||
@last_sign_in_email_address = last_email | ||
@select_email_form = build_select_email_form | ||
end | ||
|
||
def create | ||
@select_email_form = build_select_email_form | ||
|
||
result = @select_email_form.submit(form_params) | ||
if result.success? | ||
user_session[:selected_email_id] = form_params[:selected_email_id] | ||
redirect_to sign_up_completed_path | ||
else | ||
flash[:error] = result.first_error_message | ||
redirect_to sign_up_select_email_path | ||
end | ||
end | ||
|
||
def user_emails | ||
@user_emails = current_user.confirmed_email_addresses | ||
end | ||
|
||
private | ||
|
||
def build_select_email_form | ||
SelectEmailForm.new(current_user) | ||
end | ||
|
||
def form_params | ||
params.fetch(:select_email_form, {}).permit(:selected_email_id) | ||
end | ||
|
||
def last_email | ||
if user_session[:selected_email_id] | ||
user_emails.find(user_session[:selected_email_id]).email | ||
else | ||
EmailContext.new(current_user).last_sign_in_email_address.email | ||
end | ||
end | ||
|
||
def verify_needs_completions_screen | ||
redirect_to account_url unless needs_completion_screen_reason | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
class SelectEmailForm | ||
include ActiveModel::Model | ||
include ActionView::Helpers::TranslationHelper | ||
|
||
attr_reader :user, :selected_email_id | ||
|
||
validate :validate_owns_selected_email | ||
|
||
def initialize(user) | ||
@user = user | ||
end | ||
|
||
def submit(params) | ||
@selected_email_id = params[:selected_email_id] | ||
|
||
success = valid? | ||
FormResponse.new(success:, errors:) | ||
end | ||
|
||
private | ||
|
||
def validate_owns_selected_email | ||
return if user.confirmed_email_addresses.exists?(id: selected_email_id) | ||
|
||
errors.add :email, I18n.t( | ||
'email_address.not_found', | ||
), type: :selected_email_id | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class FederalEmailDomain < ApplicationRecord | ||
def self.fed_domain?(domain) | ||
exists?(name: domain) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.