Skip to content
This repository has been archived by the owner on Aug 6, 2019. It is now read-only.

error: find_or_initialize_by_login in Redmine 3.2.2 #17

Open
dani-sanchez-dorado opened this issue Feb 23, 2017 · 0 comments
Open

error: find_or_initialize_by_login in Redmine 3.2.2 #17

dani-sanchez-dorado opened this issue Feb 23, 2017 · 0 comments

Comments

@dani-sanchez-dorado
Copy link

Hello,
I have been using Redmine Rubycas for years in my Redmine 2.3.3 installation without any problem. Now, I'm migrating to Redmine 3.3.2 and I have found another error (I reported another one: #16)

Ticket "ST-10260-ebR9LVc4nTlj0ofY9cKr1jykEdIAjOdVzb6-20" for service "http://my-server.xxx.com/login" belonging to user "XXXX-valid-user-XXXXX" is VALID.
Extra user attributes provided along with ticket "ST-10260-ebR9LVc4nTlj0ofY9cKr1jykEdIAjOdVzb6-20": {}.
Completed 500 Internal Server Error in 33ms (ActiveRecord: 2.0ms)

NoMethodError (undefined method find_or_initialize_by_login' for #<Class:0x0000000556b1c0>): plugins/redmine_rubycas/lib/account_controller_patch.rb:14:in login_with_cas'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'

My Redmine configuration is this:

Environment:
Redmine version 3.3.2.stable
Ruby version 2.1.2-p95 (2014-05-08) [x86_64-linux-gnu]
Rails version 4.2.7.1
Environment production
Database adapter Mysql2
SCM:
Subversion 1.8.10
Cvs 1.12.12
Git 2.6.6
Filesystem
Redmine plugins:
clipboard_image_paste 1.8
redmine_checklists 3.1.5
redmine_ckeditor 1.1.4
redmine_edit_custom_fields 0.0.4
redmine_rubycas 0.0.6

The problem is in the call to .find_or_initialize_by_login function

Here is the patch to fix it. In file "plugins/redmine_rubycas/lib/account_controller_patch.rb"

Line 14:

user = User.find_or_initialize_by_login(session[:"#{RedmineRubyCas.setting("username_session_key")}"])

for:

user = User.find_or_initialize_by(login: session[:"#{RedmineRubyCas.setting("username_session_key")}"])

Now it works perfect. I think it would be interesting to add to source code.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant