8.4.3-ee 2FA fails on setup with 500 error
Description
It is impossible to enable 2FA in the current version of Gitlab due to a 500 error.
The logs report that this error is caused by an undefined method `scan' for nil:NilClass.
The issue is reproducible (steps below) for all users.
Reproduction Steps
- Log In
- Enter Profile Settings
- Click Account
- Click Enable Two-factor Authentication
- Scan QR code with Nexus 6p
- Input code from Google Authenticator
- Any number can be input and the same error will appear in the logs
- Click Submit
- 500 Error
Error Logs
Completed 500 Internal Server Error in 250ms (ActiveRecord: 4.8ms)
ActionView::Template::Error (undefined method `scan' for nil:NilClass):
28: %dd= current_user.email
29: %dl
30: %dt Key
31: %dd= current_user.otp_secret.scan(/.{4}/).join(' ')
32: %dl
33: %dt Time based
34: %dd Yes
app/views/profiles/two_factor_auths/new.html.haml:31:in `block in _app_views_profiles_two_factor_auths_new_html_haml___1962541301280499434_59158920'
app/views/profiles/two_factor_auths/new.html.haml:12:in `_app_views_profiles_two_factor_auths_new_html_haml___1962541301280499434_59158920'
app/controllers/profiles/two_factor_auths_controller.rb:36:in `create'