diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-04-25 14:30:59 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-04-28 22:28:36 +0530 |
commit | bafbf22c6ab613d25287d7119d7e30770c531fdb (patch) | |
tree | ecca5245e02a992e4fbbc029102d5d717b32aee8 /app/models/personal_access_token.rb | |
parent | fe5eca8b38e28ad3c77d3d71297cca110306cab9 (diff) | |
download | gitlab-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.rb | 5 |
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 |