ruby on rails - Custom Spree Devise Registration - Admin Authorization Failure -
i have added name, surname , birthdate fields devise registration. here link original question.
adding name spree devise registration
it seems on frontend side works. authorization failure alert when try access admin.
here console log:
started "/admin/orders" ::1 @ 2015-07-21 13:25:16 -0500 processing spree::admin::orderscontroller#index html spree::preference load (0.3ms) select "spree_preferences".* "spree_preferences" "spree_preferences"."key" = $1 limit 1 [["key", "spree/backend_configuration/locale"]] spree::user load (0.5ms) select "spree_users".* "spree_users" "spree_users"."deleted_at" null , "spree_users"."id" = $1 order "spree_users"."id" asc limit 1 [["id", 6]] (0.7ms) select count(*) "spree_roles" inner join "spree_roles_users" on "spree_roles"."id" = "spree_roles_users"."role_id" "spree_roles_users"."user_id" = $1 , "spree_roles"."name" = $2 [["user_id", 6], ["name", "admin"]] redirected http://localhost:3000/unauthorized completed 302 found in 88ms (activerecord: 4.1ms)
i have tried override app/controllers/spree/admin/users_controller_decorator.rb
module spree module admin userscontroller.class_eval private def user_params params.require(:user).permit(:email, :password, :password_confirmation, :spree_role_ids, :name, :surname, :birthdate) end end end end
you cant asign role admin user frontend side. please register user front end , change role backend.
Comments
Post a Comment