Skip to content

Commit 7de52b3

Browse files
Gargronhiyuki2578
authored andcommitted
Fix SSO authentication not working due to missing agreement boolean (mastodon#9915)
Fix mastodon#9906
1 parent 4a649cc commit 7de52b3

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

app/models/concerns/omniauthable.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def user_params_from_auth(auth)
6363
{
6464
email: email || "#{TEMP_EMAIL_PREFIX}-#{auth.uid}-#{auth.provider}.com",
6565
password: Devise.friendly_token[0, 20],
66+
agreement: true,
6667
account_attributes: {
6768
username: ensure_unique_username(auth.uid),
6869
display_name: display_name,

app/models/user.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ def reset_password!(new_password, new_password_confirmation)
295295

296296
def self.pam_get_user(attributes = {})
297297
return nil unless attributes[:email]
298+
298299
resource =
299300
if Devise.check_at_sign && !attributes[:email].index('@')
300301
joins(:account).find_by(accounts: { username: attributes[:email] })
@@ -304,6 +305,7 @@ def self.pam_get_user(attributes = {})
304305

305306
if resource.blank?
306307
resource = new(email: attributes[:email], agreement: true)
308+
307309
if Devise.check_at_sign && !resource[:email].index('@')
308310
resource[:email] = Rpam2.getenv(resource.find_pam_service, attributes[:email], attributes[:password], 'email', false)
309311
resource[:email] = "#{attributes[:email]}@#{resource.find_pam_suffix}" unless resource[:email]

0 commit comments

Comments
 (0)