diff options
author | David Yip <yipdw@member.fsf.org> | 2018-02-02 08:39:52 -0600 |
---|---|---|
committer | David Yip <yipdw@member.fsf.org> | 2018-02-02 08:39:52 -0600 |
commit | 4c1fd9a19c779fa6e7d74513c61f37ce05a841b3 (patch) | |
tree | 0cf23810e2f7ff0f45c65a3f2f9b35016587c68a /app/validators | |
parent | ad3a2dfb66abc01a90807f23191b7e28c3c242ed (diff) | |
parent | 33f56811e38bc330de9dcfa6794c29a176a30311 (diff) |
Merge remote-tracking branch 'tootsuite/master' into merge-upstream
Conflicts: app/javascript/styles/mastodon/components.scss
Diffstat (limited to 'app/validators')
-rw-r--r-- | app/validators/unreserved_username_validator.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/validators/unreserved_username_validator.rb b/app/validators/unreserved_username_validator.rb index 44ea4359b..c2311a89a 100644 --- a/app/validators/unreserved_username_validator.rb +++ b/app/validators/unreserved_username_validator.rb @@ -8,7 +8,13 @@ class UnreservedUsernameValidator < ActiveModel::Validator private + def pam_controlled?(value) + return false unless Devise.pam_authentication && Devise.pam_controlled_service + Rpam2.account(Devise.pam_controlled_service, value).present? + end + def reserved_username?(value) + return true if pam_controlled?(value) return false unless Setting.reserved_usernames Setting.reserved_usernames.include?(value.downcase) end |