mirror of
https://github.com/mastodon/mastodon.git
synced 2025-05-12 04:31:11 +00:00
fix: OIDC account creation fails for long display names
Truncate display name for new accounts created during OIDC login. fix: #34638
This commit is contained in:
parent
741f166407
commit
3e167e246e
|
@ -99,7 +99,7 @@ module User::Omniauthable
|
|||
external: true,
|
||||
account_attributes: {
|
||||
username: ensure_unique_username(ensure_valid_username(auth.uid)),
|
||||
display_name: auth.info.full_name || auth.info.name || [auth.info.first_name, auth.info.last_name].join(' '),
|
||||
display_name: display_name_from_auth(auth),
|
||||
},
|
||||
}
|
||||
end
|
||||
|
@ -121,5 +121,10 @@ module User::Omniauthable
|
|||
temp_username = starting_username.gsub(/[^a-z0-9_]+/i, '')
|
||||
temp_username.truncate(30, omission: '')
|
||||
end
|
||||
|
||||
def display_name_from_auth(auth)
|
||||
display_name = auth.info.full_name || auth.info.name || [auth.info.first_name, auth.info.last_name].join(' ')
|
||||
display_name.truncate(Account.DISPLAY_NAME_LENGTH_LIMIT, omission: '')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user