Note that this commit reapplies a revert by fixing an issue
relating to the mfa_settings logic in my previous commit
(g/352986) and the reversion (g/352487).
The previous commit broke the build post-merge due to me
missing some failing tests in:
spec/views/profile/_ways_to_contact.html.erb_spec.rb
Our crystalball tool does not map any of the erb files to
tests, so when the previous commit (g/352986) predicted
which tests to run it only ran:
spec/selenium/profile/profile_spec.rb
The broken tests have been fixed in this commit, plus it
includes the addition of the original code fixes.
This commit fixes the logic that controls the display of
the SMS tab when MFA is disabled for the account.
Specifically, the “Text (SMS)” tab in the “+ Contact Method”
will only be visible when in a US region and MFA is enabled.
Other improvements:
- optimized a few translations (removed keys)
- updated “Multi-Factor Authentication Backup Codes” to
only show if MFA is NOT disabled
- added helper + tests for app/helpers/profile_helper.rb
- added ProfileHelper per feedback in previous commit
- this is following the pattern we used for OtpHelper
- updated tests relating to the “+ Contact Method” modal
- added tests for the user profile MFA button logic
- added tests for _ways_to_contact.html.erb
closes FOO-4581
refs FOO-4465
flag=none
test plan, part A:
- log in to Canvas
- visit /profile/settings
- click “+ Contact Method”
- “Text (SMS)” tab SHOULD NOT BE visible
- multi-factor authentication buttons SHOULD NOT BE visible
part B:
- in a new tab visit /accounts/<id>/settings#tab-settings
- set “Multi-Factor Authentication” to “Optional”
- click “Update Settings”
- reload the /profile/settings page
- click “+ Contact Method”
- “Text (SMS)” tab SHOULD NOT BE visible (must be in US region)
- multi-factor authentication buttons SHOULD BE visible
part C:
- for testing US region, update otp_via_sms_in_us_region? to
always return true
- for local dev, this will probably be false by default
- reload the /profile/settings page
- click “+ Contact Method”
- “Text (SMS)” tab SHOULD BE visible
- multi-factor authentication buttons SHOULD BE visible
part D:
- repeat “part B” and “part C” for each of these other
“Multi-Factor Authentication” settings:
1. “Required for Admins” (test using Admin)
2. “Required”
misc:
- expect new, updated and existing tests to pass
[skip-crystalball]
Change-Id: I896771910dd9783cf1804465574242d38ba4c5f5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/353438
Reviewed-by: Jason Perry <jason.perry@instructure.com>
QA-Review: Michael Hulse <michael.hulse@instructure.com>
Product-Review: Michael Hulse <michael.hulse@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>