Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f691b1fa
Commit
f691b1fa
authored
Nov 20, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use falback to set token if encrypted field is missing
parent
bc00b814
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
app/models/concerns/token_authenticatable_strategies/encrypted.rb
...ls/concerns/token_authenticatable_strategies/encrypted.rb
+8
-2
No files found.
app/models/concerns/token_authenticatable_strategies/encrypted.rb
View file @
f691b1fa
...
@@ -24,8 +24,14 @@ module TokenAuthenticatableStrategies
...
@@ -24,8 +24,14 @@ module TokenAuthenticatableStrategies
# using factory bot to create resources, it might happen that a database
# using factory bot to create resources, it might happen that a database
# schema does not have "#{token_name}_encrypted" field yet, however a bunch
# schema does not have "#{token_name}_encrypted" field yet, however a bunch
# of models call `ensure_#{token_name}` in `before_save`.
# of models call `ensure_#{token_name}` in `before_save`.
#
super
if
instance
.
has_attribute?
(
encrypted_field
)
return
super
if
instance
.
has_attribute?
(
encrypted_field
)
if
fallback?
fallback_strategy
.
ensure_token
(
instance
)
else
raise
ArgumentError
,
'Encrypted field does not exist without fallback'
end
end
end
def
get_token
(
instance
)
def
get_token
(
instance
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment