Skip to content

LG-515 Move 2FA localizations out of Devise file#2514

Merged
monfresh merged 1 commit intomasterfrom
mb-lg-515
Sep 12, 2018
Merged

LG-515 Move 2FA localizations out of Devise file#2514
monfresh merged 1 commit intomasterfrom
mb-lg-515

Conversation

@monfresh
Copy link
Contributor

Why: The Devise locale folder is for Devise-specific strings. None
of the strings we had under the two_factor_authentication section
were related to Devise. We have a separate folder for 2FA localizations:
config/locales/two_factor_authentication

How:

  • Cut and paste anything under devise.two_factor_authentication
    into the two_factor_authentication folder
  • Run make normalize_yaml
  • Do a search and replace for devise.two_factor_authentication with
    two_factor_authentication

Hi! Before submitting your PR for review, and/or before merging it, please
go through the checklists below. These represent the more critical elements
of our code quality guidelines. The rest of the list can be found in
CONTRIBUTING.md

  • When adding a new controller that requires the user to be fully
    authenticated, make sure to add before_action :confirm_two_factor_authenticated
    as the first callback.

  • Unsafe migrations are implemented over several PRs and over several
    deploys to avoid production errors. The strong_migrations gem
    will warn you about unsafe migrations and has great step-by-step instructions
    for various scenarios.

  • Indexes were added if necessary. This article provides a good overview
    of indexes in Rails.

  • Verified that the changes don't affect other apps (such as the dashboard)

  • When relevant, a rake task is created to populate the necessary DB columns
    in the various environments right before deploying, taking into account the users
    who might not have interacted with this column yet (such as users who have not
    set a password yet)

  • Migrations against existing tables have been tested against a copy of the
    production database. See LG-228 Make migrations safer and more resilient #2127 for an example when a migration caused deployment
    issues. In that case, all the migration did was add a new column and an index to
    the Users table, which might seem innocuous.

  • The changes are compatible with data that was encrypted with the old code.

  • GET requests are not vulnerable to CSRF attacks (i.e. they don't change
    state or result in destructive behavior).

  • When adding user data to the session, use the user_session helper
    instead of the session helper so the data does not persist beyond the user's
    session.

  • Tests added for this feature/bug

  • Prefer feature/integration specs over controller specs

  • When adding code that reads data, write tests for nil values, empty strings,
    and invalid inputs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we confident that none of these are used by the two_factor_authentication gem? I was under the impression that was why we had these under the "devise" key.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. None of these are triggered by our app because we basically don't use any of the gem's controller: https://github.com/Houdini/two_factor_authentication/blob/master/config/locales/en.yml

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. I wonder at what point we should just extract the gem since with the multiple phone configurations presumably we won't be using the model code either?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not suggesting we do that here, of course. Just wondering.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that will probably need to happen at some point. It would be great if we wrote our own gem.

**Why**: The Devise locale folder is for Devise-specific strings. None
of the strings we had under the `two_factor_authentication` section
were related to Devise. We have a separate folder for 2FA localizations:
`config/locales/two_factor_authentication`

**How**:
- Cut and paste anything under `devise.two_factor_authentication`
into the `two_factor_authentication` folder
- Run `make normalize_yaml`
- Do a search and replace for `devise.two_factor_authentication` with
`two_factor_authentication`
@monfresh monfresh merged commit 91f5ca4 into master Sep 12, 2018
@monfresh monfresh deleted the mb-lg-515 branch September 12, 2018 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants