-
Notifications
You must be signed in to change notification settings - Fork 118
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 #2847 from 18F/stages/rc-2019-03-29
Deploy stages/rc-2019-03-29 to int
- Loading branch information
Showing
208 changed files
with
3,589 additions
and
1,073 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,48 @@ | ||
module AccountReset | ||
class RecoverController < ApplicationController | ||
include TwoFactorAuthenticatable | ||
|
||
before_action :confirm_two_factor_enabled | ||
before_action :confirm_user_verified | ||
|
||
def show | ||
analytics.track_event(Analytics::IAL2_RECOVERY_REQUEST_VISITED) | ||
end | ||
|
||
def create | ||
analytics.track_event(Analytics::IAL2_RECOVERY_REQUEST, analytics_attributes) | ||
Recover::CreateRecoverRequest.call(current_user.id) | ||
send_notifications | ||
redirect_to account_reset_recover_email_sent_url | ||
end | ||
|
||
private | ||
|
||
def send_notifications | ||
current_user.confirmed_email_addresses.each do |email_address| | ||
UserMailer.confirm_email_and_reverify(email_address, | ||
current_user.account_recovery_request).deliver_later | ||
end | ||
end | ||
|
||
def confirm_two_factor_enabled | ||
return if MfaPolicy.new(current_user).two_factor_enabled? | ||
|
||
redirect_to two_factor_options_url | ||
end | ||
|
||
def confirm_user_verified | ||
redirect_to account_url unless decorated_user.identity_verified? | ||
end | ||
|
||
def analytics_attributes | ||
{ | ||
event: 'request', | ||
sms_phone: TwoFactorAuthentication::PhonePolicy.new(current_user).configured?, | ||
totp: TwoFactorAuthentication::AuthAppPolicy.new(current_user).configured?, | ||
piv_cac: TwoFactorAuthentication::PivCacPolicy.new(current_user).configured?, | ||
email_addresses: current_user.email_addresses.count, | ||
} | ||
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
Oops, something went wrong.