southbridgeio / redmine_2fa

Two-factor (sms/telegram) authentication for Redmine
https://southbridge.io
MIT License
42 stars 17 forks source link

Can't login after upgrade Redmine version #87

Open swood opened 4 years ago

swood commented 4 years ago

Hello.

There is something wrong after I upgraded my Redmine version. I re-installed all plugins from the old version, however, some users can't log in due to error below:

Completed 500 Internal Server Error in 6ms (ActiveRecord: 1.4ms)

NoMethodError (undefined method `authenticate' for nil:NilClass):

app/models/user.rb:332:in `check_password?'
app/models/user.rb:232:in `try_to_login'
plugins/redmine_2fa/lib/redmine_two_fa/patches/account_controller_patch/second_authentication_prepare.rb:8:in `password_authentication'
app/controllers/account_controller.rb:213:in `authenticate_user'
app/controllers/account_controller.rb:40:in `login'
lib/redmine/sudo_mode.rb:65:in `sudo_mode'

Could you please help to fix this problem, because it looks like the plugin redmine_2fa have some role in this problem.

vladislav-yashin commented 4 years ago

Quick fix (run in rails console):

User.where.not(auth_source_id: nil).each { |u| u.update_column(:auth_source_id, nil) unless u.auth_source }

Please, let me know if it works for you.

There're will be compensational migration in the next version of plugin.

swood commented 4 years ago

Unfortunately, no, this is didn't change the behaviour.