summaryrefslogtreecommitdiff
path: root/app/models/personal_access_token.rb
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-04-25 14:30:59 +0530
committerTimothy Andrew <mail@timothyandrew.net>2016-04-28 22:28:36 +0530
commitbafbf22c6ab613d25287d7119d7e30770c531fdb (patch)
treeecca5245e02a992e4fbbc029102d5d717b32aee8 /app/models/personal_access_token.rb
parentfe5eca8b38e28ad3c77d3d71297cca110306cab9 (diff)
downloadgitlab-ce-bafbf22c6ab613d25287d7119d7e30770c531fdb.tar.gz
Address @DouweM's feedback on !3749.
- Use `TokenAuthenticatable` to generate the personal access token - Remove a check for `authenticity_token` in application controller; this should've been `authentication_token`, maybe, and doesn't make any sense now. - Have the datepicker appear inline
Diffstat (limited to 'app/models/personal_access_token.rb')
-rw-r--r--app/models/personal_access_token.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/personal_access_token.rb b/app/models/personal_access_token.rb
index c7c3932ba40..c4b095e0c04 100644
--- a/app/models/personal_access_token.rb
+++ b/app/models/personal_access_token.rb
@@ -1,4 +1,7 @@
class PersonalAccessToken < ActiveRecord::Base
+ include TokenAuthenticatable
+ add_authentication_token_field :token
+
belongs_to :user
scope :active, -> { where(revoked: false).where("expires_at >= NOW() OR expires_at IS NULL") }
@@ -6,7 +9,7 @@ class PersonalAccessToken < ActiveRecord::Base
def self.generate(params)
personal_access_token = self.new(params)
- personal_access_token.token = Devise.friendly_token(50)
+ personal_access_token.ensure_token
personal_access_token
end