Fix #2785: Allow changing API key; require password to view or change key.

This commit is contained in:
evazion
2016-12-17 22:32:01 -06:00
parent 3e285ea4ce
commit a92120e873
12 changed files with 201 additions and 78 deletions

View File

@@ -7,4 +7,8 @@ class ApiKey < ActiveRecord::Base
def self.generate!(user)
create(:user_id => user.id, :key => SecureRandom.urlsafe_base64(32))
end
def regenerate!
update!(:key => SecureRandom.urlsafe_base64(32))
end
end