Project

General

Profile

Actions

Defect #33932

closed

Can't view "My account" page when 2fa is setting to optional

Added by ChunChang (Nagaharu) Lo over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Accounts / authentication
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

error message:

Started GET "/my/account" for 59.127.53.179 at 2020-08-31 03:53:37 +0000
Processing by MyController#account as HTML
  Current user: shortie (id=3)
  Rendering my/account.html.erb within layouts/base
  Rendered my/account.html.erb within layouts/base (15.5ms)
Completed 500 Internal Server Error in 25ms (ActiveRecord: 3.5ms)

ActionView::Template::Error (uninitialized constant Redmine::Twofa::Base
Did you mean?  Base64):
    35:       <%=l 'twofa_currently_active', twofa_scheme_name: l("twofa__#{@user.twofa_scheme}__name") -%><br/>
    36:       <%= link_to l('button_disable'), { controller: 'twofa', action: 'deactivate_init', scheme: @user.twofa_scheme }, method: :post -%><br/>
    37:       <%= link_to l('twofa_generate_backup_codes'), { controller: 'twofa_backup_codes', action: 'init' }, method: :post, data: { confirm: Redmine::Twofa.for_user(User.current).backup_codes.any? ?
    38:     <% else %>
    39:       <% Redmine::Twofa.available_schemes.each do |s| %>
    40:         <%= link_to l("twofa__#{s}__label_activate"), { controller: 'twofa', action: 'activate_init', scheme: s }, method: :post -%><br/>
    41:       <% end %>

lib/redmine/twofa/totp.rb:22:in `<module:Twofa>'
lib/redmine/twofa/totp.rb:21:in `<module:Redmine>'
lib/redmine/twofa/totp.rb:20:in `<top (required)>'
lib/redmine/twofa.rb:58:in `block in scan_builtin_schemes'
lib/redmine/twofa.rb:57:in `each'
lib/redmine/twofa.rb:57:in `scan_builtin_schemes'
lib/redmine/twofa.rb:52:in `initialize_schemes'
lib/redmine/twofa.rb:45:in `schemes'
lib/redmine/twofa.rb:28:in `available_schemes'
app/views/my/account.html.erb:38:in `block in _app_views_my_account_html_erb__509002245855036881_70041001997940'
app/helpers/application_helper.rb:1404:in `labelled_form_for'
app/views/my/account.html.erb:14:in `_app_views_my_account_html_erb__509002245855036881_70041001997940'
lib/redmine/sudo_mode.rb:64:in `sudo_mode'

Related issues

Related to Redmine - Feature #1237: Add support for two-factor authenticationClosedGo MAEDA2008-05-14

Actions
Actions #1

Updated by Go MAEDA over 3 years ago

Could you describe your environment? (web server, app server)

Actions #2

Updated by Go MAEDA over 3 years ago

  • Related to Feature #1237: Add support for two-factor authentication added
Actions #3

Updated by Go MAEDA over 3 years ago

Go MAEDA wrote:

Could you describe your environment? (web server, app server)

And please paste the environment information on /admin/info page.

Actions #4

Updated by ChunChang (Nagaharu) Lo over 3 years ago

  • Redmine Environment Info:
      Redmine version                4.1.1.devel.19994
      Ruby version                   2.5.5-p157 (2019-03-15) [x86_64-linux]
      Rails version                  5.2.4.2
      Environment                    production
      Database adapter               Mysql2
      Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
      Mailer delivery                sendmail
    SCM:
      Subversion                     1.10.2
      Git                            2.18.4
      Filesystem                     
    Redmine plugins:
      no plugin installed
    
  • Other Info
    • OS: CentOS Linux 8.2.2004
    • Web Server: Apache + Phusion Passenger
    • DB: MariaDB
Actions #5

Updated by Go MAEDA over 3 years ago

I found one of my Redmine instances also raises the exception if it runs in production mode.

Could you try the following workaround? Although I am not sure whether it is the right approach, it has fixed the issue on my affected environment.

Index: lib/redmine/twofa/totp.rb
===================================================================
--- lib/redmine/twofa/totp.rb    (revision 19994)
+++ lib/redmine/twofa/totp.rb    (working copy)
@@ -17,6 +17,8 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

+require_relative 'base'
+
 module Redmine
   module Twofa
     class Totp < Base
Actions #6

Updated by ChunChang (Nagaharu) Lo over 3 years ago

yes. this workaround did fix the error. :)

I will keep this line until next pull, thanks a lot.

Actions #7

Updated by Go MAEDA over 3 years ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Affected version deleted (4.1.1)

Fixed in r19997. Thank you for reporting the issue.

Actions

Also available in: Atom PDF