2FA no longer working
Summary
After upgrading to 8.15.1 and Postgres 9.6, 2FA stopped working and trying to set it up again results in a 500 error
Steps to reproduce
- Profile Settings
- Account
- Disable 2FA if configured
- Enable 2FA
- Scan the QR code with the 2FA app
- Input generated code
- Submit
Expected behavior
2FA is successfully configured
Actual behavior
500 error
Relevant logs and/or screenshots
Started POST "/profile/two_factor_auth" for 180.200.146.183 at 2016-12-23 23:57:17 +0000
Processing by Profiles::TwoFactorAuthsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"CK0w5Y0PKJDyogiPj/ZnkK1wP4YxfUVg92eAIMau0W10BYeWTQi5rgQfbtwEbfEGWRIq+EKmlKN3mG4MSKCCDg==", "pin_code"=>"534187"}
Started POST "/ci/api/v1/builds/register.json" for 128.199.238.189 at 2016-12-23 23:57:18 +0000
Completed 500 Internal Server Error in 499ms (ActiveRecord: 4.8ms)
ActionView::Template::Error (undefined method `scan' for nil:NilClass):
33: = @account_string
34: %p.prepend-top-0.append-bottom-0
35: Key:
36: = current_user.otp_secret.scan(/.{4}/).join(' ')
37: %p.two-factor-new-manual-content
38: Time based: Yes
39: = form_tag profile_two_factor_auth_path, method: :post do |f|
app/views/profiles/two_factor_auths/show.html.haml:36:in `_app_views_profiles_two_factor_auths_show_html_haml__3615559430749586102_70261924943700'
app/controllers/profiles/two_factor_auths_controller.rb:40:in `create'
lib/gitlab/middleware/multipart.rb:93:in `call'
lib/gitlab/request_profiler/middleware.rb:15:in `call'
lib/gitlab/middleware/go.rb:16:in `call'
Output of checks
Results of GitLab application Check
Checking GitLab Shell ...
GitLab Shell version >= 4.1.1 ? ... OK (4.1.1)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
1/1 ... ok
1/2 ... ok
1/3 ... ok
1/4 ... ok
1/6 ... ok
1/9 ... ok
3/12 ... ok
3/13 ... ok
1/14 ... ok
1/15 ... ok
1/16 ... ok
1/20 ... ok
1/21 ... ok
3/22 ... ok
3/24 ... ok
1/26 ... ok
1/33 ... ok
3/34 ... ok
1/35 ... ok
1/37 ... ok
3/38 ... ok
3/39 ... ok
1/42 ... ok
3/44 ... ok
1/45 ... ok
1/46 ... ok
1/47 ... ok
65/50 ... ok
3/51 ... ok
1/52 ... ok
3/53 ... ok
3/54 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Reply by email ...
Reply by email is disabled in config/gitlab.yml
Checking Reply by email ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
projects have namespace: ...
1/1 ... yes
1/2 ... yes
1/3 ... yes
1/4 ... yes
1/6 ... yes
1/9 ... yes
3/12 ... yes
3/13 ... yes
1/14 ... yes
1/15 ... yes
1/16 ... yes
1/20 ... yes
1/21 ... yes
3/22 ... yes
3/24 ... yes
1/26 ... yes
1/33 ... yes
3/34 ... yes
1/35 ... yes
1/37 ... yes
3/38 ... yes
3/39 ... yes
1/42 ... yes
3/44 ... yes
1/45 ... yes
1/46 ... yes
1/47 ... yes
65/50 ... yes
3/51 ... yes
1/52 ... yes
3/53 ... yes
3/54 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.3)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.8.4)
Active users: 92
Checking GitLab ... Finished
Results of GitLab environment info
System information
System: Debian 8.6
Current User: git
Using RVM: no
Ruby Version: 2.3.3p222
Gem Version: 2.6.6
Bundler Version:1.13.6
Rake Version: 10.5.0
Sidekiq Version:4.2.7
GitLab information
Version: 8.15.1
Revision: 1119c1f
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
URL: https://git.simon.geek.nz
HTTP Clone URL: https://git.simon.geek.nz/some-group/some-project.git
SSH Clone URL: git@git.simon.geek.nz:some-group/some-project.git
Using LDAP: no
Using Omniauth: yes
Omniauth Providers: github, twitter, facebook
GitLab Shell
Version: 4.1.1
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git: /opt/gitlab/embedded/bin/git