diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-12-03 14:29:51 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-12-03 14:29:51 +0100 |
commit | 239a4f72642b2df0cc057a17daadf1391332d118 (patch) | |
tree | d88b8cd131d056f38bad3188487ac0ef63d9044c /app/models/concerns | |
parent | e9abacedb01efdb127580dae54a6ffbe8c8c1399 (diff) | |
download | gitlab-ce-239a4f72642b2df0cc057a17daadf1391332d118.tar.gz |
Use plaintext token when migration is not complete
Diffstat (limited to 'app/models/concerns')
-rw-r--r-- | app/models/concerns/token_authenticatable_strategies/encrypted.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/app/models/concerns/token_authenticatable_strategies/encrypted.rb b/app/models/concerns/token_authenticatable_strategies/encrypted.rb index 1f752850aad..2e65a2b6b22 100644 --- a/app/models/concerns/token_authenticatable_strategies/encrypted.rb +++ b/app/models/concerns/token_authenticatable_strategies/encrypted.rb @@ -12,16 +12,18 @@ module TokenAuthenticatableStrategies def find_token_authenticatable(token, unscoped = false) return if token.blank? - return find_by_encrypted_token(token, unscoped) if fully_encrypted? + + if fully_encrypted? + return find_by_encrypted_token(token, unscoped) + end if fallback? find_by_encrypted_token(token, unscoped) || find_by_plaintext_token(token, unscoped) elsif migrating? - find_by_plaintext_token(token, unscoped) || - find_by_encrypted_token(token, unscoped) + find_by_plaintext_token(token, unscoped) else - raise ArgumentError, 'Unknown encryption strategy!' + raise ArgumentError, 'Unknown encryption phase!' end end |