refinerycms icon indicating copy to clipboard operation
refinerycms copied to clipboard

create a new user breaks the users section

Open will-greene opened this issue 16 years ago • 17 comments

Hi guys, I ran into this bug after i tried to create a second user for a refinery app (0.9.7 source). The user got created and upon redirection to /refinery/users the following error arose.


Rendering template within layouts/admin Rendering admin/users/index

ActionView::TemplateError (edit_admin_user_url failed to generate from {:controller=>"admin/users", :action=>"edit", :id=>#<User id: 2, login: "LOGIN", email: "EMAIL", crypted_password: "XXXXXXXXXXXXXXXXXXXX", password_salt: "XXXXXXXXXXXXXXXX", persistence_token: "7a82117e2e9945727a75b6f35c644763c73a15c609a1766d03d...", created_at: "2010-07-02 14:51:43", updated_at: "2010-07-02 14:54:57", perishable_token: "Fx6r0FXpiP_ubwnGHWwX">}, expected: {:controller=>"admin/users", :action=>"edit"}, diff: {:id=>#<User id: 2, login: "LOGIN", email: "EMAIL", crypted_password: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", password_salt: "XXXXXXXXXXXXXX", persistence_token: "7a82117e2e9945727a75b6f35c644763c73a15c609a1766d03d...", created_at: "2010-07-02 14:51:43", updated_at: "2010-07-02 14:54:57", perishable_token: "Fx6r0FXpiP_ubwnGHWwX">}) on line #12 of vendor/plugins/authentication/app/views/admin/users/_user.html.erb: 9: <%= link_to refinery_icon_tag('delete.png'), admin_user_path(user), 10: :class => "cancel confirm-delete", 11: :title => t('.confirm_delete_title') if current_user.can_delete?(user) %> 12: <%= link_to refinery_icon_tag('application_edit.png'), edit_admin_user_path(user), 13: :title => t('.edit_user')%> 14: <%= mail_to user.email, refinery_icon_tag('email_go.png'), 15: :title => t('.email_user') %>


Sorry I can't be of more assistance in figuring this out; still just scratching the surface of rails. ps. loving refineryhq, hope it goes great for ye guys, i'll be sure to spread the word about it.

Will

will-greene avatar Jul 02 '10 22:07 will-greene

Hi there, I was unable to reproduce the problem on a new install from the GitHub source.

Is this a brand new install or was it an upgrade?

stevenheidel avatar Jul 03 '10 00:07 stevenheidel

I can't reproduce either.. which database etc are you using?

parndt avatar Jul 03 '10 05:07 parndt

Can you check whether this is fixed with version 0.9.7.1 just released?

parndt avatar Jul 03 '10 07:07 parndt

Hi, sorry for the delayed response. that error was for a brand new install of refinery

DB: sqlite3-ruby 1.3.0

Error popped up again upon attempt to create second user with a build of the latest source

ActionView::TemplateError (admin_user_url failed to generate from {:action=>"show", :controller=>"admin/users", :id=>#<User id: 2, login: "LOGIN", email: "EMAIL", crypted_password: "XXXXXXXXXXXXXXXXXXXXXXXX", password_salt: "XXXXXXXXXXXXXXXX", persistence_token: "ece1232e59cb3bd666b34e74eb607c2446583d9663d2f394b05...", created_at: "2010-07-03 21:43:05", updated_at: "2010-07-03 21:43:05", perishable_token: "NH-zceKPHE8cD8Luu1Yv">}, expected: {:action=>"show", :controller=>"admin/users"}, diff: {:id=>#<User id: 2, login: "LOGIN", email: "EMAIL", crypted_password: "XXXXXXXXXXXXXXXXXXXXXXXXX", password_salt: "XXXXXXXXXXXXXXX", persistence_token: "ece1232e59cb3bd666b34e74eb607c2446583d9663d2f394b05...", created_at: "2010-07-03 21:43:05", updated_at: "2010-07-03 21:43:05", perishable_token: "NH-zceKPHE8cD8Luu1Yv">}) on line #9 of vendor/plugins/authentication/app/views/admin/users/_user.html.erb: 6: 7: 8: 9: <%= link_to refinery_icon_tag('delete.png'), admin_user_path(user), 10: :class => "cancel confirm-delete", 11: :title => t('.confirm_delete_title') if current_user.can_delete?(user) %> 12: <%= link_to refinery_icon_tag('application_edit.png'), edit_admin_user_path(user),

(eval):17:in `admin_user_path'
vendor/plugins/authentication/app/views/admin/users/_user.html.erb:9
vendor/plugins/authentication/app/views/admin/users/index.html.erb:12

will-greene avatar Jul 03 '10 20:07 will-greene

Hm, I can't get this to happen... I tried a couple combinations of usernames, passwords, and plugin access but mine always worked.

stevenheidel avatar Jul 03 '10 23:07 stevenheidel

Hello, I seem to be getting the same error as above. I used the following commands to update my instance of refinery

git remote add refinerycms git://github.com/resolve/refinerycms.git git pull refinerycms master

I am using sqlite3 as my dev db as well.

Error happens as I select the Users tab from the admin interface.

ActionController::RoutingError in Admin/users#index

Showing vendor/plugins/authentication/app/views/admin/users/_user.html.erb where line #13 raised:

edit_admin_user_url failed to generate from {:controller=>"admin/users", :action=>"edit", :id=>#<User id: 1, login: "[email protected]", email: "[email protected]", crypted_password: "07d1c0e9079eea88aa2e881a634e968e71abdbfc", password_salt: "Q4ogsiUJZMJzpOiLCrZL", persistence_token: "e66040b655cb8eaa98231c9a30cc66725a3ef3ea375e187746c...", created_at: "2010-07-29 11:17:48", updated_at: "2010-07-29 11:17:48", perishable_token: "mSO8JvNJj3WfU2Ywaabg">}, expected: {:controller=>"admin/users", :action=>"edit"}, diff: {:id=>#<User id: 1, login: "[email protected]", email: "[email protected]", crypted_password: "07d1c0e9079eea88aa2e881a634e968e71abdbfc", password_salt: "Q4ogsiUJZMJzpOiLCrZL", persistence_token: "e66040b655cb8eaa98231c9a30cc66725a3ef3ea375e187746c...", created_at: "2010-07-29 11:17:48", updated_at: "2010-07-29 11:17:48", perishable_token: "mSO8JvNJj3WfU2Ywaabg">}

Extracted source (around line #13):

10: :class => "cancel confirm-delete", 11: :title => t('.confirm_delete_title'), 12: :'data-confirm' => t('.confirm_delete_message', :who => user.login) if current_user.can_delete?(user) %> 13: <%= link_to refinery_icon_tag('application_edit.png'), edit_admin_user_path(user), 14: :title => t('.edit_user')%> 15: <%= mail_to user.email, refinery_icon_tag('email_go.png'), 16: :title => t('.email_user') %>

Trace of template inclusion: vendor/plugins/authentication/app/views/admin/users/index.html.erb

gsonbuchner avatar Jul 30 '10 03:07 gsonbuchner

What is the user's username , email address , password so that I can reproduce?

parndt avatar Jul 30 '10 03:07 parndt

Hello, This is the 3rd line from the error page.
user => [email protected] email => [email protected] password => pass123

edit_admin_user_url failed to generate from {:controller=>"admin/users", :action=>"edit", :id=>#<User id: 1, login: "[email protected]", email: "[email protected]", crypted_password: "07d1c0e9079eea88aa2e881a634e968e71abdbfc", password_salt: "Q4ogsiUJZMJzpOiLCrZL", persistence_token: "e66040b655cb8eaa98231c9a30cc66725a3ef3ea375e187746c...", created_at: "2010-07-29 11:17:48", updated_at: "2010-07-29 11:17:48", perishable_token: "mSO8JvNJj3WfU2Ywaabg">}, expected: {:controller=>"admin/users", :action=>"edit"}, diff: {:id=>#<User id: 1, login: "[email protected]", email: "[email protected]", crypted_password: "07d1c0e9079eea88aa2e881a634e968e71abdbfc", password_salt: "Q4ogsiUJZMJzpOiLCrZL", persistence_token: "e66040b655cb8eaa98231c9a30cc66725a3ef3ea375e187746c...", created_at: "2010-07-29 11:17:48", updated_at: "2010-07-29 11:17:48", perishable_token: "mSO8JvNJj3WfU2Ywaabg">}

gsonbuchner avatar Jul 30 '10 03:07 gsonbuchner

Right.. so why are you creating a user with a username that is an email address even though you have an email address field? This is causing it to break.. Might be able to workaround this, but that's a weird thing to do.

parndt avatar Jul 30 '10 03:07 parndt

The 3rd line was truncated above. Here is the entire third line.

edit_admin_user_url failed to generate from {:controller=>"admin/users", :action=>"edit", :id=>#<User id: 1, login: "[email protected]", email: "[email protected]", crypted_password: "07d1c0e9079eea88aa2e881a634e968e71abdbfc", password_salt: "Q4ogsiUJZMJzpOiLCrZL", persistence_token: "e66040b655cb8eaa98231c9a30cc66725a3ef3ea375e187746c...", created_at: "2010-07-29 11:17:48", updated_at: "2010-07-29 11:17:48", perishable_token: "mSO8JvNJj3WfU2Ywaabg">},

expected: {:controller=>"admin/users", :action=>"edit"}, diff: {:id=>#<User id: 1, login: "[email protected]", email: "[email protected]", crypted_password: "07d1c0e9079eea88aa2e881a634e968e71abdbfc", password_salt: "Q4ogsiUJZMJzpOiLCrZL", persistence_token: "e66040b655cb8eaa98231c9a30cc66725a3ef3ea375e187746c...", created_at: "2010-07-29 11:17:48", updated_at: "2010-07-29 11:17:48", perishable_token: "mSO8JvNJj3WfU2Ywaabg">}

gsonbuchner avatar Jul 30 '10 03:07 gsonbuchner

You can login with your email or your username.

stevenheidel avatar Jul 30 '10 03:07 stevenheidel

Support email addresses in the username field using slugs. However, this doesn't change the fact that you can use either field to login. Relates to and closed by b118d4e73aa881e9eceb942e44f6a68cc31e3811

parndt avatar Jul 30 '10 03:07 parndt

It felt really weird, but I am used to having my user id be the same as that email. So I used it, to not have to remember a different user for development. If I change the user in the db will that fix this?

gsonbuchner avatar Jul 30 '10 04:07 gsonbuchner

just set an arbitrary username, you can login with your email address anyway.

parndt avatar Jul 30 '10 04:07 parndt

Thanks for your very prompt response to these questions. I changed the user from

[email protected] to gsonbuchner in the users table using SQLite3. It allows me to log in as gsonbuchner, but gives me the same message as above.

edit_admin_user_url failed to generate from {:controller=>"admin/users", :action=>"edit", :id=>#<User id: 1, login: "[email protected]", email: "[email protected]", crypted_password: "07d1c0e9079eea88aa2e881a634e968e71abdbfc", password_salt: "Q4ogsiUJZMJzpOiLCrZL", persistence_token: "e66040b655cb8eaa98231c9a30cc66725a3ef3ea375e187746c...", created_at: "2010-07-29 11:17:48", updated_at: "2010-07-29 11:17:48", perishable_token: "mSO8JvNJj3WfU2Ywaabg">},

expected: {:controller=>"admin/users", :action=>"edit"}, diff: {:id=>#<User id: 1, login: "[email protected]", email: "[email protected]", crypted_password: "07d1c0e9079eea88aa2e881a634e968e71abdbfc", password_salt: "Q4ogsiUJZMJzpOiLCrZL", persistence_token: "e66040b655cb8eaa98231c9a30cc66725a3ef3ea375e187746c...", created_at: "2010-07-29 11:17:48", updated_at: "2010-07-29 11:17:48", perishable_token: "mSO8JvNJj3WfU2Ywaabg">}

If I login using the email I get the following error:

ActiveRecord::StatementInvalid in SessionsController#create

SQLite3::BusyException: database is locked: UPDATE "users" SET "updated_at" = '2010-07-29 23:15:32', "perishable_token" = 'BGk6yPKnsaGsYwpBEHcN' WHERE "id" = 1

gsonbuchner avatar Jul 30 '10 04:07 gsonbuchner

I'd be deleting the user and starting again at this point.

parndt avatar Jul 30 '10 04:07 parndt

Thank you for your help. I deleted the user in the db and the system allowed me to create a new admin.

gsonbuchner avatar Jul 30 '10 04:07 gsonbuchner