Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/concerns/token_authenticatable_strategies/base.rb')
-rw-r--r--app/models/concerns/token_authenticatable_strategies/base.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/concerns/token_authenticatable_strategies/base.rb b/app/models/concerns/token_authenticatable_strategies/base.rb
index f0f7107d627..413721d3e6c 100644
--- a/app/models/concerns/token_authenticatable_strategies/base.rb
+++ b/app/models/concerns/token_authenticatable_strategies/base.rb
@@ -43,10 +43,14 @@ module TokenAuthenticatableStrategies
set_token(instance, new_token)
end
+ def unique
+ @options.fetch(:unique, true)
+ end
+
def generate_available_token
loop do
token = generate_token
- break token unless find_token_authenticatable(token, true)
+ break token unless unique && find_token_authenticatable(token, true)
end
end