The change you wanted was rejected

Hello guys,

I’m diasporabr.com.br pod and I’m facing this issue when new accounts are created. Right after thet submit that error screen come saying “422 The change you wanted was rejected. Maybe you tried to change something you didn’t have access to.”

The account is created anyway but users think it didn’t because of that error… can you please help me to fix it?

Thanks!

diaspora_error_422

Anything in the logs?

I think this is it

[2021-06-03T11:53:53] INFO  PID-28090 TID-69893215803740 ActionController::Base: Completed 200 OK in 27ms (Views: 21.2ms | ActiveRecord: 0.3ms)
[2021-06-03T11:53:54] INFO  PID-28090 TID-69893215803740 Rails: Started POST "/users" for 187.115.178.134 at 2021-06-03 11:53:54 -0300
[2021-06-03T11:53:54] INFO  PID-28090 TID-69893215803740 ActionController::Base: Processing by RegistrationsController#create as HTML
[2021-06-03T11:53:54] INFO  PID-28090 TID-69893215803740 ActionController::Base:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"MIJAWS1xsJT_aj_K21N3pptO5bL4jx2RAiWJ91wnXR6OFmk9
26ZWFY-Qs__DpVC4LcQWfPhEs2kUa4EvJza5aQ", "user"=>{"email"=>"teste3@testegt.com.br", "username"=>"jhagfdc3", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "captch
a"=>"31393", "captcha_key"=>"2717bbf6714a69ce954c2478d464569608bd3cd8"}, "commit"=>"Criar conta"}
[2021-06-03T11:53:54] INFO  PID-28088 TID-69893215803740 Rails: Started GET "/stream" for 187.86.14.230 at 2021-06-03 11:53:54 -0300
[2021-06-03T11:53:54] INFO  PID-28088 TID-69893215803740 ActionController::Base: Processing by StreamsController#multi as */*
[2021-06-03T11:53:54] INFO  PID-28088 TID-69893215803740 ActionController::Base: Completed 401 Unauthorized in 2ms (ActiveRecord: 0.0ms)
[2021-06-03T11:53:54] INFO  PID-28088 TID-69893215803740 Rails: Started GET "/users/sign_in" for 187.86.14.230 at 2021-06-03 11:53:54 -0300
[2021-06-03T11:53:54] INFO  PID-28088 TID-69893215803740 ActionController::Base: Processing by SessionsController#new as */*
[2021-06-03T11:53:54] INFO  PID-28088 TID-69893215803740 ActionController::Base: Completed 200 OK in 35ms (Views: 32.9ms | ActiveRecord: 0.0ms)

that’s the test user I created just now “jhagfdc3”

I don’t see any 422 reply in there, I think you cut that log a bit short unfortunately. The 401 seems to be in response of the parallel /stream request by another user.

thanks for you time and help. I do appreciate that a lot.
I went back to the logs and cut another chunk of it… please take a look

[2021-06-03T11:53:54] INFO  PID-28088 TID-69893215803740 Rails: Started POST "/users/sign_in" for 187.86.14.230 at 2021-06-03 11:53:54 -0300
[2021-06-03T11:53:54] INFO  PID-28088 TID-69893215803740 ActionController::Base: Processing by SessionsController#create as */*                                                     [2021-06-03T11:53:54] INFO  PID-28088 TID-69893215803740 ActionController::Base:   Parameters: {"user"=>{"password"=>"[FILTERED]", "username"=>"anahuacpg"}, "authenticity_token"=>"tY4Hpn2ro0OXRsU_3f9rmOGwqxgcsJl_RubIomrX1IShcQ2AYVp-NBKXEg1zxDuFjO2SWHWGmM3e-EUyOi59KA"}
[2021-06-03T11:53:54] INFO  PID-28088 TID-69893215803740 ActionController::Base: Redirected to https://diasporabr.com.br/stream                                                     [2021-06-03T11:53:54] INFO  PID-28088 TID-69893215803740 ActionController::Base: Completed 302 Found in 135ms (ActiveRecord: 23.4ms)                                                [2021-06-03T11:53:54] INFO  PID-28088 TID-69893215803740 Rails: Started POST "/receive/public" for 159.69.231.139 at 2021-06-03 11:53:54 -0300                                      [2021-06-03T11:53:54] INFO  PID-28088 TID-69893215803740 ActionController::Base: Processing by DiasporaFederation::ReceiveController#public as */*
[2021-06-03T11:53:54] INFO  PID-28088 TID-69893215803740 DiasporaFederation::ReceiveController: received a public magic envelope
[2021-06-03T11:53:54] INFO  PID-28088 TID-69893215803740 ActionController::Base: Completed 202 Accepted in 1ms (ActiveRecord: 0.0ms)                                                [2021-06-03T11:53:55] INFO  PID-28088 TID-69893215803740 Rails: Started GET "/stream" for 187.86.14.230 at 2021-06-03 11:53:55 -0300
[2021-06-03T11:53:55] INFO  PID-28088 TID-69893215803740 ActionController::Base: Processing by StreamsController#multi as */*
[2021-06-03T11:53:55] INFO  PID-28088 TID-69893215803740 ActionController::Base: Completed 401 Unauthorized in 2ms (ActiveRecord: 0.0ms)
[2021-06-03T11:53:56] INFO  PID-28088 TID-69893215803740 Rails: Started GET "/users/sign_in" for 187.86.14.230 at 2021-06-03 11:53:56 -0300
[2021-06-03T11:53:56] INFO  PID-28088 TID-69893215803740 ActionController::Base: Processing by SessionsController#new as */*
[2021-06-03T11:53:56] INFO  PID-28088 TID-69893215803740 ActionController::Base: Completed 200 OK in 85ms (Views: 82.4ms | ActiveRecord: 0.0ms)
[2021-06-03T11:53:56] INFO  PID-28088 TID-69893215803740 Rails: Started POST "/users/sign_in" for 187.86.14.230 at 2021-06-03 11:53:56 -0300
[2021-06-03T11:53:56] INFO  PID-28088 TID-69893215803740 ActionController::Base: Processing by SessionsController#create as */*
[2021-06-03T11:53:56] INFO  PID-28088 TID-69893215803740 ActionController::Base:   Parameters: {"user"=>{"password"=>"[FILTERED]", "username"=>" barboza2308@diasporabr.com.br "}, "authenticity_token"=>"kD1yuuN0A2tSwFx5DuAbjB9DmY_TokrBwiKb3WK84izgOxxqDviGZa4T1LOfrZ0xf70Pv2vWxsMNy9bajhUuvg"}
[2021-06-03T11:53:56] INFO  PID-28088 TID-69893215803740 ActionController::Base: Completed 401 Unauthorized in 16ms (ActiveRecord: 0.6ms)
[2021-06-03T11:53:56] INFO  PID-28088 TID-69893215803740 ActionController::Base: Processing by SessionsController#new as */*
[2021-06-03T11:53:56] INFO  PID-28088 TID-69893215803740 ActionController::Base:   Parameters: {"user"=>{"password"=>"[FILTERED]", "username"=>" barboza2308@diasporabr.com.br "}, "authenticity_token"=>"kD1yuuN0A2tSwFx5DuAbjB9DmY_TokrBwiKb3WK84izgOxxqDviGZa4T1LOfrZ0xf70Pv2vWxsMNy9bajhUuvg"}
[2021-06-03T11:53:56] INFO  PID-28090 TID-69893215803740 ActionController::Base: Completed 422 Unprocessable Entity in 2014ms (ActiveRecord: 153.7ms)
[2021-06-03T11:53:56] FATAL PID-28090 TID-69893215803740 Rails:
[2021-06-03T11:53:56] FATAL PID-28090 TID-69893215803740 Rails: ActiveRecord::RecordInvalid (A validação falhou: Contacts não é válido):
[2021-06-03T11:53:56] FATAL PID-28090 TID-69893215803740 Rails:
[2021-06-03T11:53:56] FATAL PID-28090 TID-69893215803740 Rails: app/controllers/registrations_controller.rb:20:in `create'
[2021-06-03T11:53:56] INFO  PID-28088 TID-69893215803740 ActionController::Base: Completed 200 OK in 182ms (Views: 32.2ms | ActiveRecord: 0.0ms)
[2021-06-03T11:53:57] INFO  PID-28090 TID-69893215803740 Rails: Started GET "/stream" for 187.86.14.230 at 2021-06-03 11:53:57 -0300
[2021-06-03T11:53:57] INFO  PID-28090 TID-69893215803740 ActionController::Base: Processing by StreamsController#multi as */*
[2021-06-03T11:53:57] INFO  PID-28090 TID-69893215803740 ActionController::Base: Completed 401 Unauthorized in 2ms (ActiveRecord: 0.0ms)
[2021-06-03T11:53:57] INFO  PID-28088 TID-69893215803740 Rails: Started GET "/users/sign_in" for 187.86.14.230 at 2021-06-03 11:53:57 -0300
[2021-06-03T11:53:57] INFO  PID-28088 TID-69893215803740 ActionController::Base: Processing by SessionsController#new as */*
[2021-06-03T11:53:57] INFO  PID-28088 TID-69893215803740 ActionController::Base: Completed 200 OK in 35ms (Views: 32.9ms | ActiveRecord: 0.0ms)
[2021-06-03T11:53:57] INFO  PID-28090 TID-69893215803740 Rails: Started POST "/users/sign_in" for 187.86.14.230 at 2021-06-03 11:53:57 -0300

This is the line with 422 error code

2021-06-03T11:53:56] INFO PID-28090 TID-69893215803740 ActionController::Base: Completed 422 Unprocessable Entity in 2014ms (ActiveRecord: 153.7ms)

This is super weird! I don’t see how line 20 could cause this. Can you check if you have any local modifications to that file?

I can look at it… but I’m not sure what I’m suppose to look at.
I mean, I’m the only person with access to this server and I never touched that file.

May I just replace it for an original one pulled from github?

This is line 20 in registrations_controller.rb

sign_in_and_redirect(:user, @user)

create function

def create
@user = User.build(user_params)

if @user.sign_up
  flash[:notice] = t("registrations.create.success")
  @user.process_invite_acceptence(invite) if invite.present?
  @user.seed_aspects
  @user.send_welcome_message
  sign_in_and_redirect(:user, @user)
  logger.info "event=registration status=successful user=#{@user.diaspora_handle}"
else
  @user.errors.delete(:person)
                                                                                                                                                                                      flash.now[:error] = @user.errors.full_messages.join(" - ")
  logger.info "event=registration status=failure errors='#{@user.errors.full_messages.join(', ')}'"
  render action: "new"
end

end

FTR I diff original file from github and mine installed and there is no difference at all.

Please guys… give me a hand with it

I also have no idea why it fails when trying to login. The error says something wrong with contacts?

But the user “jhagfdc3” was created successfully: jhagfdc3@diasporabr.com.br

So registration itself works, but the automatic login then fails (but people can still manually login afterwards). So something between user-creation and login/redirect fails.

Do you have anything else configured that could affect registrations. Did you for example set a settings.autofollow_on_join_user, and is that setting correct? Or did you configure a settings.welcome_message? Also it looks like your admins.account you configured in the diaspora.yml/diaspora.toml seems to be closed: https://diasporabr.com.br/u/anahuac, maybe that’s also causing some problems?

So, you nailed it!

As soon as I commented the autofollow_on_join_user in diaspora.yml it worked as expected

Thank you very much for the help and assistance.