summaryrefslogtreecommitdiff
path: root/lib/tasks/tokens.rake
diff options
context:
space:
mode:
authorImre Farkas <ifarkas@gitlab.com>2018-10-29 16:06:45 +0000
committerJan Provaznik <jprovaznik@gitlab.com>2018-10-29 16:06:45 +0000
commitb9652d8e4dc8544766c9371057be72cc26fe3a4b (patch)
treedd4c8407af4ef5d98a20f30069d3a348773dfbfa /lib/tasks/tokens.rake
parentb5ca4ea15dee21b131b336d4189a75a283c8d1f1 (diff)
downloadgitlab-ce-b9652d8e4dc8544766c9371057be72cc26fe3a4b.tar.gz
[master] Persist only SHA digest of PersonalAccessToken#token
Diffstat (limited to 'lib/tasks/tokens.rake')
-rw-r--r--lib/tasks/tokens.rake14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/tasks/tokens.rake b/lib/tasks/tokens.rake
index 81829668de8..eec024f9bbb 100644
--- a/lib/tasks/tokens.rake
+++ b/lib/tasks/tokens.rake
@@ -1,4 +1,7 @@
require_relative '../../app/models/concerns/token_authenticatable.rb'
+require_relative '../../app/models/concerns/token_authenticatable_strategies/base.rb'
+require_relative '../../app/models/concerns/token_authenticatable_strategies/insecure.rb'
+require_relative '../../app/models/concerns/token_authenticatable_strategies/digest.rb'
namespace :tokens do
desc "Reset all GitLab incoming email tokens"
@@ -26,13 +29,6 @@ class TmpUser < ActiveRecord::Base
self.table_name = 'users'
- def reset_incoming_email_token!
- write_new_token(:incoming_email_token)
- save!(validate: false)
- end
-
- def reset_feed_token!
- write_new_token(:feed_token)
- save!(validate: false)
- end
+ add_authentication_token_field :incoming_email_token, token_generator: -> { SecureRandom.hex.to_i(16).to_s(36) }
+ add_authentication_token_field :feed_token
end