-
Notifications
You must be signed in to change notification settings - Fork 167
Add controller/view/xlations/specs for recovery flow reboot #1470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,20 @@ | ||
| class ReactivateAccountController < ApplicationController | ||
| before_action :confirm_two_factor_authenticated | ||
| before_action :confirm_password_reset_profile | ||
|
|
||
| def index | ||
| user_session[:acknowledge_personal_key] ||= true | ||
| end | ||
|
|
||
| def update | ||
| user_session.delete(:acknowledge_personal_key) | ||
| redirect_to verify_url | ||
| end | ||
|
|
||
| protected | ||
|
|
||
| def confirm_password_reset_profile | ||
| return if current_user.decorate.password_reset_profile | ||
| redirect_to root_url | ||
| end | ||
| end | ||
This file contains hidden or 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 hidden or 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,22 @@ | ||
| - title t('titles.reactivate_account') | ||
|
|
||
| h1.h3.mt0.mb2 = t('headings.account.reactivate') | ||
|
|
||
| p.mb4 = t('instructions.account.reactivate.intro') | ||
|
|
||
| h2.h4.pb1.border-bottom = t('instructions.account.reactivate.begin') | ||
|
|
||
| h3.fs-20p.sans-serif.mt4 = t('instructions.account.reactivate.with_key') | ||
|
|
||
| p.mb0 = t('instructions.account.reactivate.explanation') | ||
|
|
||
| .scale-down | ||
| = render 'partials/personal_key/key', code: 'XXXX-XXXX-XXXX-XXXX' | ||
|
|
||
| .block-center.center.col-10 | ||
| .col-12.mb2 | ||
| = link_to t('links.account.reactivate.with_key'), reactivate_account_path, | ||
| class: 'btn btn-primary block' | ||
| = form_tag manage_reactivate_account_path, method: :put, class: 'col-12' do | ||
| = button_tag t('links.account.reactivate.without_key'), type: 'submit', | ||
| class: 'btn btn-secondary block col-12' |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 @@ | ||
| require 'rails_helper' | ||
|
|
||
| describe ReactivateAccountController do | ||
| let(:user) { create(:user, profiles: profiles) } | ||
| let(:profiles) { [] } | ||
|
|
||
| before { stub_sign_in(user) } | ||
|
|
||
| describe 'before_actions' do | ||
| it 'requires the user to be logged in' do | ||
| expect(subject).to have_actions( | ||
| :confirm_two_factor_authenticated | ||
| ) | ||
| end | ||
| end | ||
|
|
||
| describe '#index' do | ||
| context 'with a password reset profile' do | ||
| let(:profiles) { [create(:profile, deactivation_reason: :password_reset)] } | ||
|
|
||
| it 'renders the index template' do | ||
| get :index | ||
|
|
||
| expect(subject).to render_template(:index) | ||
| end | ||
|
|
||
| it 'sets a key on the user session for future redirect guidance' do | ||
| get :index | ||
|
|
||
| expect(subject.user_session[:acknowledge_personal_key]).to eq true | ||
| end | ||
| end | ||
|
|
||
| context 'wthout a password reset profile' do | ||
| let(:profiles) { [create(:profile, :active)] } | ||
| it 'redirects to the root url' do | ||
| get :index | ||
|
|
||
| expect(response).to redirect_to root_url | ||
| end | ||
| end | ||
| end | ||
|
|
||
| describe '#update' do | ||
| let(:profiles) { [create(:profile, deactivation_reason: :password_reset)] } | ||
|
|
||
| it 'redirects user to verify_url' do | ||
| put :update | ||
|
|
||
| expect(subject.user_session[:acknowledge_personal_key]).to be_nil | ||
| expect(response).to redirect_to verify_url | ||
| end | ||
| end | ||
| end |
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code climate is highlighting this as untested, can we add a scenario for visiting without the correct profile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think the cleanest way to test this is? Stub out a user and the password_reset_profile method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have a spec that signs in to the controller with a user that has no profiles?