Skip to content

Commit 1801be3

Browse files
Remove explicit consent check during Omniauth registration
This was added very recently to improve rendering of consent errors in all registration flows. However, for the omniauth case it kicked us out of the flow that would end up in `render_omniauth_registration_form`. Thus a failed consent would switch from the omniauth registration form (that has no password and auth provider inputs, but connects the resulting user to their original auth provider) to the regular registration form. By removing this check, confirming the consent during the registration form is not required anymore. This is at least consistent with remaining omniauth behaviour. Lacking a required field, the user would be created first and then asked to confirm the consent in a separate step. This is what happens now as well. Caveat: Even if the consent is confirmed during the registration form, the second step will pop up anyways. This issue exists regardless of keeping or removing this check and is one more thing we need to fix about omniauth registrations.
1 parent d629d5b commit 1801be3

2 files changed

Lines changed: 0 additions & 29 deletions

File tree

app/controllers/concerns/accounts/registration.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ def register_with_auth_source(user) # rubocop:disable Metrics/AbcSize
7272
# on-the-fly registration via omniauth or via auth source
7373
if pending_omniauth_registration?
7474
user.assign_attributes permitted_params.user_register_via_omniauth
75-
return unless consent_given_for_registration?(user)
76-
7775
register_via_omniauth(session, permitted_params.user_register_via_omniauth)
7876
else
7977
user.attributes = permitted_params.user

spec/controllers/account_controller_spec.rb

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,33 +1365,6 @@ def reset!
13651365
expect(user.identity_url).to eql("google:123545")
13661366
end
13671367

1368-
context "with consent required",
1369-
with_settings: {
1370-
consent_required: true,
1371-
consent_info: { en: "# Consent header!" }
1372-
} do
1373-
it "renders the registration form with a consent error" do
1374-
session[:auth_source_registration] = omniauth_hash.merge(
1375-
omniauth: true,
1376-
timestamp: Time.current
1377-
)
1378-
1379-
post :register,
1380-
params: {
1381-
user: {
1382-
login: "login@bar.com",
1383-
firstname: "Foo",
1384-
lastname: "Smith",
1385-
mail: "foo@bar.com"
1386-
}
1387-
}
1388-
1389-
expect(response).to render_template :register
1390-
expect(assigns(:user).errors[:consent_check]).to contain_exactly(I18n.t("consent.failure_message"))
1391-
expect(User.find_by_login("login@bar.com")).to be_nil
1392-
end
1393-
end
1394-
13951368
context "when after a timeout expired" do
13961369
before do
13971370
session[:auth_source_registration] = omniauth_hash.merge(

0 commit comments

Comments
 (0)