Merge pull request #2080 from Xenograph/fix-sso-override
Username/email change should not be allowed with SSO and username/email override enabled
This commit is contained in:
commit
cbf269fdbf
|
@ -6,12 +6,14 @@ module UserGuardian
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_edit_username?(user)
|
def can_edit_username?(user)
|
||||||
|
return false if (SiteSetting.sso_overrides_username? && SiteSetting.enable_sso?)
|
||||||
return true if is_staff?
|
return true if is_staff?
|
||||||
return false if SiteSetting.username_change_period <= 0
|
return false if SiteSetting.username_change_period <= 0
|
||||||
is_me?(user) && (user.post_count == 0 || user.created_at > SiteSetting.username_change_period.days.ago)
|
is_me?(user) && (user.post_count == 0 || user.created_at > SiteSetting.username_change_period.days.ago)
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_edit_email?(user)
|
def can_edit_email?(user)
|
||||||
|
return false if (SiteSetting.sso_overrides_email? && SiteSetting.enable_sso?)
|
||||||
return true if is_staff?
|
return true if is_staff?
|
||||||
return false unless SiteSetting.email_editable?
|
return false unless SiteSetting.email_editable?
|
||||||
can_edit?(user)
|
can_edit?(user)
|
||||||
|
|
Loading…
Reference in New Issue