diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-03-16 18:29:52 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-03-16 18:29:52 +0100 |
commit | 9cb690c70690bcebba69d3b66fb0b90e798d477d (patch) | |
tree | f282ae79be96067138b53adf6603ea8d5663e8a7 /app/models | |
parent | 786397e15dde5500deb1d324e7e62ec13bb61178 (diff) |
Access tokens no longer expire, case-insensitive local username validation, as well as case-insensitive Webfinger look-up
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/account.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index b3917e6e8..c92bb1574 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -1,7 +1,7 @@ class Account < ActiveRecord::Base # Local users has_one :user, inverse_of: :account - validates :username, uniqueness: { scope: :domain } + validates :username, uniqueness: { scope: :domain, case_sensitive: false } # Avatar upload attr_reader :avatar_remote_url @@ -97,6 +97,11 @@ class Account < ActiveRecord::Base self.username end + def self.find_local!(username) + table = self.arel_table + self.where(table[:username].matches(username)).where(domain: nil).take! + end + before_create do if local? keypair = OpenSSL::PKey::RSA.new(Rails.env.test? ? 1024 : 2048) |